Windows Forms FAQ

ASP.NET FAQ

Welcome to the ASP.NET FAQ.  Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion.

I would like to specially acknowledge the efforts of Microsoft MVP, Sushila Patel, for her assistance.  Many of the articles originated from her responses on various ASP.NET newsgroups.  She also spent many hours helping with the composition of this FAQ.

I have tried to mention the source wherever possible.  If you think that you should be credited for an answer, please send me a note and I will be happy to add a credit mention.

If you have a FAQ, or any other good ASP.NET resource, please email me. You can also access the ASP.NET FAQ forum for more information.

You can also access the Windows Forms FAQ Home WPF FAQ Home

Search Help
 

1. WebService

  

2. Development and Deployment Issues

  

   2.1Why are Server control tags shown in the browser instead of the controls it represents?
   2.2Where can we download IIS?
   2.3How To Repair ASP.Net IIS Mapping After You Remove and Reinstall IIS?
   2.4Why do I get "HTTP 500" error (or "(DLL) initialization routine failed") in my browser?
   2.5I have recently move my Web application from Windows 2k to Windows Server 2003. All works fine in Windows 2K but i am not able to view pages using Windows Server 2003?
   2.6What are the Best practices for side-by-side execution of Framework 1.0 and 1.1?
   2.7Can I have VS.NET and the Visual Studio 6.0 installed on the same machine?
   2.8How should I check whether IIS is installed or not?
   2.9In Visual Studio .NET, how do I create a new ASP.NET application for an existing ASP.NET project?
   2.10Why do I get the error message "Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request."?
   2.11In Visual Studio .NET, how do I create a new ASP.NET application which does not have a physical path under wwwroot?
   2.12Why do I get the "Unable to find script library 'WebUIValidation.js'" error ?
   2.13After installing .NET Framework SP1 the client side validations, or rather validator controls are not working?
   2.14How to Configure the ASP.NET Version to use for Each Application(developed using 1.0 or 1.1)?
   2.15How to Configure Different Versions of an ASP.NET Application Running on the Same Web Server?
   2.16Why do I get error message "Internet Explorer cannot download MyPage.aspx from MyWebSite.com ..."?
   2.17Why do I get error message "Unable to start debugging on the web server. The server does not support debugging of ASP.NET or ATL Server applications. ..."?

3. Basic

  

   3.1What is ASP.NET?
   3.2Why does my ASP.NET file have multiple <form> tag with runat=server?
   3.3How to find out what version of ASP.NET I am using on my machine?
   3.4Is it possible to pass a querystring from an .asp page to aspx page?
   3.5How to comment out ASP.NET Tags?
   3.6What is a ViewState?
   3.7Where can I get the details on Migration of existing projects using various technologies to ASP.NET?
   3.8What is the equivalent of date() and time() in ASP.NET?
   3.9How to prevent a button from validating it's form?
   3.10How to get the IP address of the host accessing my site?
   3.11How to access the Parameters passed in via the URL?
   3.12How to Set Focus to Web Form Controls By Using Client-Side Script?
   3.13How to display a Wait page while a query is running?
   3.14How to implement Form based Authentication in ASP.NET application?
   3.15How to catch the 404 error in my web application and provide more useful information?
   3.16Is there a method similar to Response.Redirect that will send variables to the destination page other than using a query string or the post method?
   3.17What are the differences between HTML versus Server Control?
   3.18How can I change the action of a form through code?
   3.19Is there any control that allows user to select a time from a clock - in other words is there a clock control?
   3.20How to Compare time?
   3.21How To work with TimeSpan Class?
   3.22Where can I get information on Cookies in ASP.NET?
   3.23Does ASP.Net still recognize the global.asa file?
   3.24How should I destroy my objects in ASP.Net?
   3.25Are there resources online with tips on ASP to ASP.Net conversions?
   3.26How do I publish my ASP.NET application to my ISP's web server?
   3.27Why do i get error message "Could not load type" whenever I browse to my ASP.NET web site?
   3.28Will the WebMatrix SqlDataSourceControl work with a MySQL connection?
   3.29Can I combine classic ASP and ASP.NET pages?
   3.30What is the difference between src and Code-Behind?
   3.31How can I get the value of input box with type hidden in code-behind?
   3.32I have created a .NET user control page (.ascx) but I cannot compile and run it.
   3.33What is a .resx file?
   3.34Is it possible to use a style sheet class directly on a control instead of using inline or page-level formatting ?
   3.35Can I receive both HTML markup for page and code in the ASP.NET web page's source code portion in the Web browser?
   3.36Why can't I put <%@ Page Language="C " %> where at the top of an ASPX file and write my server-side scripts in C ?
   3.37ASP pages that worked perfectly on Windows 2000 Server and IIS 5.0 do not work on Windows 2003 Server with IIS 6.0. ASP.NET pages work fine. Why?
   3.38Why do I get error message "Error creating assembly manifest: Error reading key file 'key.snk' -- The system cannot find the file specified"?
   3.39How to get URL without querystring?
   3.40What is the best way to output only time and not Date?
   3.41Do I have to compile code if I am changing the content of my aspx.cs file?
   3.42How to grab the referring URL?
   3.43My ASP code gives an error "Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed" when changed to .aspx?
   3.44How can I save images ?
   3.45How can I logout when using FormsAuthentication?
   3.46Why do I get a blank page when I use Server.Transfer("page1.htm") to transfer to a different page?
   3.47How to detect the User's culture?
   3.48What is the difference between CurrentCulture property and the CurrentUICulture property?
   3.49Can I read the hard disk serial # of the client computer using ASP.NET?
   3.50What is xxx(src As Object, e As EventArgs)?
   3.51What is the difference between Absolute vs Relative URLs?
   3.52What is the difference between URL and URI?
   3.53How to convert milliseconds into time?
   3.54How to include multiple vb/cs files in the source?
   3.55How to convert a string to Proper Case?
   3.56How can I ensure that application-level variables are not updated by more than one user simultaneously?
   3.57Why do I get the error message "System.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a ...."?
   3.58How to validate that a string is a valid date?
   3.59Are namespaces and Class names Case Sensitive?
   3.60How to convert string to a DateTime and compare it with another DateTime?
   3.61How to get the url of page dynamically?
   3.62How to convert user input in dMy format to Mdy?
   3.63When the User is prompted a File Download dialogbox, if the user selects "Save" then the "Save as" dialog box is displayed. Is there any way for me to retrieve the filename and directory path specified by the user on the File Download dialog box?
   3.64How to hide or show Controls in server side code?
   3.65How to check if the user is using a secure or non secure connection?
   3.66Is it possible to write code in many languages in one ASP.NET project?
   3.67What is the difference between Response.Redirect() and Server.Transfer().
   3.68How to get the hostname or IP address of the server?
   3.69What is the meaning of validateRequest=true in .net framework1.1?
   3.70What is the different between <%# %> and <%= %>?
   3.71What permissions do ASP.NET applications posses by default?
   3.72How can I specify the relative path for a file?
   3.73How can I specify the "upload a file" input textbox in a form to be read only so that the user can click on the browse button and pick a file but they cannot type anything into the textbox next to the browse button.
   3.74How to change the Page Title dynamically?
   3.75Why do I get the error message "Object must implement IConvertible". How can I resolve it?
   3.76Why is default.aspx page not opened if i specify http://localhost. I am able to view this page if i hardcode it as http://localhost/default.aspx?
   3.77Can ASP.NET work on an NT server?
   3.78Is it possible to migrate Visual InterDev Design-Time Controls to ASP.NET?
   3.79How to automatically get the latest version of all the asp.net solution items from Source Safe when opening the solution?
   3.80How to convert the datetime into a string for use in the SQL ' statement?
   3.81How to make VS.Net use FlowLayout as the default layout rather than the GridLayout?
   3.82Can I use a DataReader to update/insert/delete a record?
   3.83What is the difference between Server.Transfer and Server.Execute?
   3.84How to create a login screen in ASP.NET?
   3.85How to format a Telephone number in the xxx-xxx-xxxx format?
   3.86Can two different programming languages be mixed in a single ASPX file?
   3.87Can I use custom .NET data types in a Web form?
   3.88How can I have a particular Web page in an ASP.NET application which displays its own error page.
   3.89How to use absolute positioning for controls in a web page in VS2005?
   3.90What is an Literal Control.
   3.91How can we programmatically verify whether the UserName and Password is Correct?
   3.92Can users create multiple interface applications?
   3.93What are the tips for cloning ASP.NET web forms?
   3.94How to boost web performance with multithreading?
   3.95Can users use placeholder control in ASP.NET?
   3.96Can users host ASP.NET applications?
   3.97Could users page and sort Resultsets with ASP.NET?
   3.98What are the tips on making ASP.NET design decisions?
   3.99How can users use ASP.NET to make application development easy?
   3.100How to customize my site using WebParts?
   3.101How to choose between Repeater, DataList and DataGrid?
   3.102How to Manage Web Sites With ASP.NET?
   3.103How to implement a "back" link on a web page?
   3.104How can users Standardize their .NET Namespaces?
   3.105How can users Visually Bind to Data in ASP.NET?
   3.106Should users use DataReader or DataSet to retrieve data?
   3.107How to Separate Form, Function, and Style?

4. Debugging and Error Handling

  

   4.1What utility can users use to Debug their Web Matrix Code?
   4.2How to debug Design-Time controls?
   4.3What options do users have to control exception behaviors?
   4.4What are some of the new and innovative ways to use the ASP.NET Tracing features?
   4.5How to debug apps effectively with TraceContext?
   4.6What is the new ASP.NET development feature that will allow users to debug their ASP.NET Apps?
   4.7How do I specify break-points in my code?
   4.8Why do I get Error message "Unable to Start Debugging" Error Message When You Send Debug HTTP Request?
   4.9Why do I get the error message "Unable to start debugging on the web server..." when I debug?
   4.10When I Debug ASP.NET Applications I get error message "Access Is Denied. Check the DCOM Configuration Settings for the Machine Debug Manager"?
   4.11On Trying to Debug an application, by the F5 key I get the error: "Error while trying to run project: Unable to start debugging on the web server. Catastrophic failure"?
   4.12How to configure my project for debugging ASP Code?
   4.13In Visual Studio .NET, whenever I try to debug my ASP.NET application I'm not able to stop the debugger on my breakpoints. Why?
   4.14Why do I get error message "Unable to start debugging on the web server. The debugger is not properly installed. Run setup to install or repair the debugger. Would you like to disable future attempts to debug ASP.NET pages for this project ? "?
   4.15How do I debug JavaScript and other script code in my application using Visual Studio .Net?
   4.16What are the different exception-handling approaches that can be used in ASP.NET?
   4.17Why do I get error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"?
   4.18Why do I get the Error Message "System.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown."?
   4.19Why do I get the error message "Sql Server does not exists or access denied " whenever I try to access the data on Sql server?
   4.20Why do I get error message "It is already opened exclusively by another user, or you need permission to view its data." when I try to open Access mdb?
   4.21Why do I get the "HTTP 404 - File not found." error message as "The page cannot be found.The page you are looking for might have been removed, had its name changed, or is temporarily unavailable "?
   4.22When I install the Microsoft .NET Framework 1.1 on a computer that is running Windows XP, and then you start Windows, the Welcome screen appears. This screen prompts me to click your user name to start Windows.Why?
   4.23Why do I get the error message "System.InvalidOperationException: Application is restarting"?
   4.24How can I see the Trace messages?
   4.25I have installed ASP.NET hotfix and I find that Startup Type of the ASP.NET Session State Service is set to Manual.Why?
   4.26Why do I get the error message "aspnet_wp.exe (PID: XXXX) was recycled because it was suspected to be in a deadlocked state "?
   4.27How to display errors using Page_Error event of Page Object?
   4.28How to redirect the user to the friendly error-handler page when an Application error occurs?
   4.29How to Enable Remote Debugging on Windows XP Service Pack 2?
   4.30Why do I get error message ""Parser Error Message: Access is denied: Source Error: Line xxx : ""?
   4.31Why do I get the error message "A potentially dangerous Request.Form value was detected from the client "?
   4.32How can I test performance of the Web application?
   4.33How can I resolve the error message "Cannot access file '...' because it is being used by another process"?
   4.34Why do I get the Compiler Error Message: "CS0246: The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?) "?
   4.35Why do I get the error message "Compiler Error Message: CS1595"?
   4.36I get error message at runtime "Value null was found where an instance of an object was required" when using Application state variables. why?
   4.37I installed Windows 2003 Standard Edition, then VS.NET and SQL Server 2K with SP3. When I build web project connecting to the database in VS.NET, the compiler gives me the following error:Login failed for user 'NT AUTHORITY\NETWORK SERVICE',why?
   4.38Why do I get error message "System.Threading.ThreadAbortException: Thread was being aborted" while using Response.Redirect?
   4.39Why do I get the error message "BC30451: Name 'ConfigurationSettings' is not declared"?
   4.40What is a parser error?
   4.41Whenever I browse to one of my ASP.NET web pages, Internet Explorer keeps on asking me if I want to download it, or it just displays the ASPX source. Why?
   4.42Why am I getting the error: "Type '(OleDb or SQL)Connection' is not defined."?
   4.43Why do I get the Error message "Operation must use an updateable query"?
   4.44When compiling I get "Could not copy temporary files to the output directory" or "The process cannot access the file because it is being used by another process" error messages. Why?
   4.45Why do I get error message "Failed to Start Monitoring Directory Changes" when i try to browse ASP.NET page?
   4.46Why do I get Compilation error "<Control> is not a member of <Page>"?
   4.47How can the default focus can be set when a error occurs?
   4.48When compiling I get "Could not copy temporary files to the output directory" or "The process cannot access the file because it is being used by another process" error messages. Why?
   4.49Why do I get the error message "BC30451: Name 'ConfigurationSettings' is not declared"?
   4.50How can I have a particular Web page in an ASP.NET application which displays its own error page.
   4.51Why do I get error message "Unable to start debugging on the web server. The server does not support debugging of ASP.NET or ATL Server applications. ..."?
   4.52In Visual Studio .NET, whenever I try to debug my ASP.NET application I'm not able to stop the debugger on my breakpoints. Why?
   4.53How can I use Tracing in Custom Components?
   4.54How to see the Message in the Output window using ASP.NET?

5. ASP.NET

  

   5.1How the computer's name,OSVersion,Memory Working set can be identified using ASP.NET?

6. Templates

  

   6.1How can Templates simplify frequent website updates?
   6.2How can users create boilerplate templates?
   6.3How can users make a more versatile Page Template class in ASP.NET?
   6.4How can users use page templates to apply a consistent look to their website?

7. Caching

  

   7.1How to boost performance by using ASP.NET page and data-caching techniques?
   7.2How can users use the .NET Framework's caching functionality to Enhance Performance?
   7.3How can users clean out VSWebCache?
   7.4How to wire up your own cache expiration callbacks?

8. Calendar

  

   8.1How can users use Microsoft's free Web Matrix tool to automate an event calendar for ASP.NET development?
   8.2How to display multiple dates selected in Calendar Control?
   8.3How to reset the selected date in the calendar control?
   8.4How to Customize Individual Days in a Calendar Web Server Control?
   8.5Is there a way to click an image and let the calendar Control appear?
   8.6How to Programmatically change backgroundcolor of a Calendar Control using Dropdown List?
   8.7How can I change the month and Weekdays to Japanese characters for a Calendar Control?
   8.8How can I use a Calendar Control to show specific dates highlighted and display relevant data for that date?
   8.9How to clear the Calendar Control Selection?
   8.10How can I set the Selection of the Calendar Control to date or week or month?
   8.11How can I display the calendar control in different languages according to the navigator culture?
   8.12How to display full day names in a Calendar Control?
   8.13How to hide the WeekDay Header in the Calendar control?
   8.14How to hide "other months" in a Calendar Control?
   8.15How to highlight today's date in Calendar Control in different color?
   8.16How can I use a Calendar Control in readonly mode. i.e no links for the day and month cells.
   8.17How to change the Calendar Dates using a Dropdownlist?

9. User Controls

  

   9.1How to handle events from web user controls?
   9.2What ways can users communicate between users controls?
   9.3How can I include an Asp.NET page in many other Asp.Net pages so that I don't need to rewrite the code?
   9.4Is there anything similar to web templates in ASP that I can use in ASP.Net?
   9.5Are there any settings on the application level to make certain elements appear on every page without having to manually insert code or insert UserControls?
   9.6How to pass a parameter to a user control?
   9.7How to add user control dynamically into another usercontrol?
   9.8I have a function inside of the .ascx file. How can I call it from the web application page(the .aspx file)?
   9.9How to dynamically load User Controls?
   9.10How to change the imageurl of the image control that exists in a usercontrol?

10. DataList

  

   10.1Why is the DataList not displayed on the web page?
   10.2How to change the colors of a row to indicate its the Birthday of the Employee (for example) in a DataList?
   10.3How to group the data in the DataList?
   10.4Which control should I use when binding a multidimensional array?
   10.5How to display data in multiple columns for a specific Column in a table in an ASP.NET page?
   10.6How to use a Hyperlink in a DataList?
   10.7How to do Paging in DataList?
   10.8How to hide and show data in the DataList?
   10.9How to add a Templatecolumn dynamically to a DataList?
   10.10How to create a File Picker in ASP.NET?
   10.11How can I get a list of all the environment variables?
   10.12How to display checkbox in a DataList and highlight a row if the value of checkbox is true?
   10.13How to display all System Colors in a DataList?

11. Repeater

  

   11.1How to display alphabetically sorted data in Repeater?
   11.2How to display the Directory names in the Repeater Control?
   11.3How to define HeaderTemplate and ItemTemplate to the Repeater at runtime TBD?
   11.4How to add a TemplateColumn dynamically to Repeater?
   11.5How to implement sorting using Repeater?
   11.6Can I specify ItemStyle to a Repeater Control?
   11.7How to change the row color of the Repeater based on some condition?

12. Security

  

   12.1Are there ways to secure my Directory-Enabled Apps?
   12.2What application-level techniques can users implement to safeguard their password-protected ASP.NET apps?
   12.3What forms authentication are available for users to Secure their Mobile Apps?
   12.4How to increase the flexibility and security of your Web apps?
   12.5How to call web services through secured fire walls?
   12.6What is the difference between authentication and authorization?
   12.7How to implement authentication via web.config?
   12.8How to run a Web application using the permission of an authenticated user?
   12.9Which are the different ASP.NET authentication modes?
   12.10How to determine the Windows User from a Web form Application?
   12.11After installing SP4 none of my ASP.NET pages developed using Framework 1.0 are showing the errors related to security?

13. CheckBox

  

   13.1How to assign a text to Checkbox control and know which checkbox is selected?
   13.2How to validate a CheckBox?

14. Client Side Scripting

  

   14.1What approaches can users use to add Client-side script code?
   14.2How can users use ASP.NET's server side methods to implement client scripts?
   14.3Is there a JavaScript Quick Reference Guide?
   14.4How to emit client-side javascript blocks from VB.NET/C#?
   14.5How to open a new Window using javascript function from a Link button?
   14.6How to set the background color of a web page using code behind?
   14.7How to resolve error message "String constants must end with a double quote."?
   14.8Why can't I open a new browser window from within server code?
   14.9How to get the confirmation of Yes/No from a javascript pop-up and display the value on the page?
   14.10How to open a browser window with maximum size on click of a button?
   14.11How can I know if the client browser supports active scripting?
   14.12How to show Modal and Modeless dialog windows in Javascript?
   14.13How to determine if the Browser supports javascript?
   14.14How can I change the scroll bar color?
   14.15How to create dynamic javascripts in server side code based on server side variables?
   14.16How can I use a Timer Control to refresh a page automatically at a specified interval?
   14.17How to open a new window without IE menus and toolbars on click of a button?
   14.18Does JavaScript support hashtables/ hash tables or dictionary type data structures?
   14.19How to disable the right click option on a web page?
   14.20How to hide a control using javascript?
   14.21Can I modify WebUIValidation.js?
   14.22How to change a Label element's text in javascript?
   14.23How to resize two <div> tags on a webform?
   14.24How to check/ uncheck a checkbox based on the text entered in textbox?
   14.25How to rotate a Label Text?
   14.26How to display a message in the status bar of a browser window?
   14.27How to change the BackgroundColor of a page based on the value selected in a DropdownList?
   14.28How to disable a Dropdownlist once someone has selected an item in the Dropdownlist?
   14.29How can I make a Textbox a mandatory field if a checkbox is checked on a button click event in the client side?
   14.30Why does the SmartNavigation does not work on the live server but works perfectly on the Development Machine?
   14.31How to pop up a message box when no item in the dropdownlist is selected before postback?
   14.32How to create files on the client m/c using JavaScript?
   14.33How to parse the files/folders in the client's file system?
   14.34How can i form a regular expression which identifies a valid whole number without decimal places?
   14.35Is it possible to identify the source webpage where I came from?
   14.36How can i resize the dialog window?
   14.37How the browser name can be detected?
   14.38How can we check whether a function exists in javascript?
   14.39How can you generate a clock in javascript?
   14.40How can we check whether the cookie is enabled?
   14.41How can I check whether left or right mouse button has been clicked?
   14.42How can you identify the drives available in the System?
   14.43How can I add and remove an Html element dynamically using javascript?
   14.44How can you make the text to scroll in the window's status bar?
   14.45How can you avoid postback on submit button?
   14.46Is there Trim function available in Javascript?
   14.47How can you resize the html elements dynamically?
   14.48How can you get the X Co-ordinates Y Co-ordinates values during the Mouse Movement?
   14.49How can you make a piece of text get moving along the mouse Movement?
   14.50Can I access the query string using JavaScript?
   14.51How can the 'Enter' key be disabled?
   14.52How can you do ClientSide Validation?
   14.53How can the a client side function be called on a button click event?
   14.54Is it possible to identify the source web page where I came from?
   14.55How can I resize the window?
   14.56Are there any resources regarding the Mozilla specific Browser Objects and CSS information?

15. XML

  

   15.1How to Bind XML Data in ASP.NET?
   15.2How to write the data from database into an XML file?
   15.3How to read data from an XML file and display it in a DataGrid?
   15.4How to read data from the XML file using FileStream and display it in a DataGrid?
   15.5How to save an xml-string into an Xml document?
   15.6How to use the <asp:xml> tag?
   15.7How to display the Attribute values in an XML Document in a DataGrid?

16. CheckBoxList

  

   16.1How to retrieve the multiple selected items in a CheckBoxList?
   16.2How to check if nothing is selected in a CheckBoxList without using a loop to parse through all the items?

17. AdRotator

  

   17.1How can users create a MultiRotar server control to display a series of banners from a single data source while preventing duplicates?
   17.2How to use an AdRotator in ASP.NET?
   17.3Why do I get a blank image when I set the KeywordFilter property of the AdRotator?
   17.4How to extract the information between the ImageUrl of an Advertisement file?

18. Files

  

   18.1Are there ways to parse text files with Regular Expressions?
   18.2How to remove a Key From an INI File?
   18.3What is the best way to rename a file on the webserver in code?
   18.4How to create a folder in ASP.NET?
   18.5How to show the ASP.NET code to the users?
   18.6How to read a html file in ASP.NET?
   18.7How can I to get the path to the system area that holds temporary files?
   18.8How to save a file in the client machine?
   18.9How to get the physical path of a file?