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. Debugging and Error Handling

  

   2.1What utility can users use to Debug their Web Matrix Code?
   2.2How to debug Design-Time controls?
   2.3What options do users have to control exception behaviors?
   2.4What are some of the new and innovative ways to use the ASP.NET Tracing features?
   2.5How to debug apps effectively with TraceContext?
   2.6What is the new ASP.NET development feature that will allow users to debug their ASP.NET Apps?
   2.7How do I specify break-points in my code?
   2.8Why do I get Error message "Unable to Start Debugging" Error Message When You Send Debug HTTP Request?
   2.9When I Debug ASP.NET Applications I get error message "Access Is Denied. Check the DCOM Configuration Settings for the Machine Debug Manager"?
   2.10On 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"?
   2.11How to configure my project for debugging ASP Code?
   2.12In Visual Studio .NET, whenever I try to debug my ASP.NET application I'm not able to stop the debugger on my breakpoints. Why?
   2.13Why do I get the error message "Unable to start debugging on the web server..." when I debug?
   2.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 ? "?
   2.15How do I debug JavaScript and other script code in my application using Visual Studio .Net?
   2.16What are the different exception-handling approaches that can be used in ASP.NET?
   2.17Why do I get error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"?
   2.18Why do I get the Error Message "System.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown."?
   2.19When 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?
   2.20Why 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 "?
   2.21Why do I get the error message "Sql Server does not exists or access denied " whenever I try to access the data on Sql server?
   2.22Why 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?
   2.23How to Enable Remote Debugging on Windows XP Service Pack 2?
   2.24Why do I get the error message "aspnet_wp.exe (PID: XXXX) was recycled because it was suspected to be in a deadlocked state "?
   2.25How to display errors using Page_Error event of Page Object?
   2.26How to redirect the user to the friendly error-handler page when an Application error occurs?
   2.27Why do I get error message ""Parser Error Message: Access is denied: Source Error: Line xxx : ""?
   2.28Why do I get the error message "A potentially dangerous Request.Form value was detected from the client "?
   2.29How can I test performance of the Web application?
   2.30How can I resolve the error message "Cannot access file '...' because it is being used by another process"?
   2.31Why 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?) "?
   2.32Why do I get the error message "Compiler Error Message: CS1595"?
   2.33Why do I get the error message "System.InvalidOperationException: Application is restarting"?
   2.34How can I see the Trace messages?
   2.35I have installed ASP.NET hotfix and I find that Startup Type of the ASP.NET Session State Service is set to Manual.Why?
   2.36Why do I get error message "System.Threading.ThreadAbortException: Thread was being aborted" while using Response.Redirect?
   2.37I get error message at runtime "Value null was found where an instance of an object was required" when using Application state variables. why?
   2.38I 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?
   2.39What is a parser error?
   2.40Why am I getting the error: "Type '(OleDb or SQL)Connection' is not defined."?
   2.41Why do I get the Error message "Operation must use an updateable query"?
   2.42Whenever 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?
   2.43When 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?
   2.44Why do I get the error message "BC30451: Name 'ConfigurationSettings' is not declared"?
   2.45Why do I get error message "Failed to Start Monitoring Directory Changes" when i try to browse ASP.NET page?
   2.46Why do I get Compilation error "<Control> is not a member of <Page>"?
   2.47How can the default focus can be set when a error occurs?
   2.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?
   2.49Why do I get the error message "BC30451: Name 'ConfigurationSettings' is not declared"?
   2.50How can I have a particular Web page in an ASP.NET application which displays its own error page.
   2.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. ..."?
   2.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?
   2.53How to see the Message in the Output window using ASP.NET?
   2.54How can I use Tracing in Custom Components?

3. Development and Deployment Issues

  

   3.1Why are Server control tags shown in the browser instead of the controls it represents?
   3.2Where can we download IIS?
   3.3How To Repair ASP.Net IIS Mapping After You Remove and Reinstall IIS?
   3.4I 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?
   3.5Why do I get "HTTP 500" error (or "(DLL) initialization routine failed") in my browser?
   3.6What are the Best practices for side-by-side execution of Framework 1.0 and 1.1?
   3.7Can I have VS.NET and the Visual Studio 6.0 installed on the same machine?
   3.8How should I check whether IIS is installed or not?
   3.9Why 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."?
   3.10In Visual Studio .NET, how do I create a new ASP.NET application which does not have a physical path under wwwroot?
   3.11In Visual Studio .NET, how do I create a new ASP.NET application for an existing ASP.NET project?
   3.12Why do I get the "Unable to find script library 'WebUIValidation.js'" error ?
   3.13After installing .NET Framework SP1 the client side validations, or rather validator controls are not working?
   3.14How to Configure the ASP.NET Version to use for Each Application(developed using 1.0 or 1.1)?
   3.15How to Configure Different Versions of an ASP.NET Application Running on the Same Web Server?
   3.16Why do I get error message "Internet Explorer cannot download MyPage.aspx from MyWebSite.com ..."?
   3.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. ..."?

4. Basic

  

   4.1What is ASP.NET?
   4.2Why does my ASP.NET file have multiple <form> tag with runat=server?
   4.3How to find out what version of ASP.NET I am using on my machine?
   4.4Is it possible to pass a querystring from an .asp page to aspx page?
   4.5How to comment out ASP.NET Tags?
   4.6What is a ViewState?
   4.7Where can I get the details on Migration of existing projects using various technologies to ASP.NET?
   4.8What is the equivalent of date() and time() in ASP.NET?
   4.9How to prevent a button from validating it's form?
   4.10How to get the IP address of the host accessing my site?
   4.11How to access the Parameters passed in via the URL?
   4.12How to Set Focus to Web Form Controls By Using Client-Side Script?
   4.13How to display a Wait page while a query is running?
   4.14How to implement Form based Authentication in ASP.NET application?
   4.15How to catch the 404 error in my web application and provide more useful information?
   4.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?
   4.17What are the differences between HTML versus Server Control?
   4.18How can I change the action of a form through code?
   4.19Is there any control that allows user to select a time from a clock - in other words is there a clock control?
   4.20How to Compare time?
   4.21How To work with TimeSpan Class?
   4.22Where can I get information on Cookies in ASP.NET?
   4.23Does ASP.Net still recognize the global.asa file?
   4.24How should I destroy my objects in ASP.Net?
   4.25Are there resources online with tips on ASP to ASP.Net conversions?
   4.26How do I publish my ASP.NET application to my ISP's web server?
   4.27Why do i get error message "Could not load type" whenever I browse to my ASP.NET web site?
   4.28Can I combine classic ASP and ASP.NET pages?
   4.29What is the difference between src and Code-Behind?
   4.30Will the WebMatrix SqlDataSourceControl work with a MySQL connection?
   4.31How can I get the value of input box with type hidden in code-behind?
   4.32I have created a .NET user control page (.ascx) but I cannot compile and run it.
   4.33What is a .resx file?
   4.34Is it possible to use a style sheet class directly on a control instead of using inline or page-level formatting ?
   4.35How to grab the referring URL?
   4.36My ASP code gives an error "Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed" when changed to .aspx?
   4.37How can I save images ?
   4.38How can I logout when using FormsAuthentication?
   4.39How to get URL without querystring?
   4.40Why can't I put <%@ Page Language="C " %> where at the top of an ASPX file and write my server-side scripts in C ?
   4.41Why do I get a blank page when I use Server.Transfer("page1.htm") to transfer to a different page?
   4.42How to detect the User's culture?
   4.43What is the difference between CurrentCulture property and the CurrentUICulture property?
   4.44ASP 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?
   4.45What is the best way to output only time and not Date?
   4.46Do I have to compile code if I am changing the content of my aspx.cs file?
   4.47Can I read the hard disk serial # of the client computer using ASP.NET?
   4.48What is xxx(src As Object, e As EventArgs)?
   4.49How can I ensure that application-level variables are not updated by more than one user simultaneously?
   4.50Can I receive both HTML markup for page and code in the ASP.NET web page's source code portion in the Web browser?
   4.51Why do I get error message "Error creating assembly manifest: Error reading key file 'key.snk' -- The system cannot find the file specified"?
   4.52What is the difference between Absolute vs Relative URLs?
   4.53What is the difference between URL and URI?
   4.54How to convert milliseconds into time?
   4.55How to include multiple vb/cs files in the source?
   4.56How to convert a string to Proper Case?
   4.57How to convert string to a DateTime and compare it with another DateTime?
   4.58How to get the url of page dynamically?
   4.59How to convert user input in dMy format to Mdy?
   4.60Why 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 ...."?
   4.61When 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?
   4.62How to hide or show Controls in server side code?
   4.63How to validate that a string is a valid date?
   4.64Are namespaces and Class names Case Sensitive?
   4.65What is the difference between Response.Redirect() and Server.Transfer().
   4.66How to get the hostname or IP address of the server?
   4.67What is the meaning of validateRequest=true in .net framework1.1?
   4.68What is the different between <%# %> and <%= %>?
   4.69How to check if the user is using a secure or non secure connection?
   4.70Is it possible to write code in many languages in one ASP.NET project?
   4.71What permissions do ASP.NET applications posses by default?
   4.72Why 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?
   4.73Can ASP.NET work on an NT server?
   4.74How can I specify the relative path for a file?
   4.75How 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.
   4.76How to change the Page Title dynamically?
   4.77Why do I get the error message "Object must implement IConvertible". How can I resolve it?
   4.78Is it possible to migrate Visual InterDev Design-Time Controls to ASP.NET?
   4.79How to automatically get the latest version of all the asp.net solution items from Source Safe when opening the solution?
   4.80How to convert the datetime into a string for use in the SQL ' statement?
   4.81How to make VS.Net use FlowLayout as the default layout rather than the GridLayout?
   4.82Can I use a DataReader to update/insert/delete a record?
   4.83What is the difference between Server.Transfer and Server.Execute?
   4.84How to create a login screen in ASP.NET?
   4.85How to format a Telephone number in the xxx-xxx-xxxx format?
   4.86Can two different programming languages be mixed in a single ASPX file?
   4.87Can I use custom .NET data types in a Web form?
   4.88How can I have a particular Web page in an ASP.NET application which displays its own error page.
   4.89How to use absolute positioning for controls in a web page in VS2005?
   4.90What is an Literal Control.
   4.91How can we programmatically verify whether the UserName and Password is Correct?
   4.92How to customize my site using WebParts?
   4.93How to choose between Repeater, DataList and DataGrid?
   4.94How to Manage Web Sites With ASP.NET?
   4.95How to implement a "back" link on a web page?
   4.96How can users Standardize their .NET Namespaces?
   4.97How can users Visually Bind to Data in ASP.NET?
   4.98Should users use DataReader or DataSet to retrieve data?
   4.99How to Separate Form, Function, and Style?
   4.100Can users create multiple interface applications?
   4.101What are the tips for cloning ASP.NET web forms?
   4.102How to boost web performance with multithreading?
   4.103Can users use placeholder control in ASP.NET?
   4.104Can users host ASP.NET applications?
   4.105Could users page and sort Resultsets with ASP.NET?
   4.106What are the tips on making ASP.NET design decisions?
   4.107How can users use ASP.NET to make application development easy?

5. Templates

  

   5.1How can Templates simplify frequent website updates?
   5.2How can users create boilerplate templates?
   5.3How can users make a more versatile Page Template class in ASP.NET?
   5.4How can users use page templates to apply a consistent look to their website?

6. ASP.NET

  

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

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 to change the Calendar Dates using a Dropdownlist?
   8.11How to hide the WeekDay Header in the Calendar control?
   8.12How to hide "other months" in a Calendar Control?
   8.13How to highlight today's date in Calendar Control in different color?
   8.14How can I use a Calendar Control in readonly mode. i.e no links for the day and month cells.
   8.15How can I display the calendar control in different languages according to the navigator culture?
   8.16How to display full day names in a Calendar Control?
   8.17How can I set the Selection of the Calendar Control to date or week or month?

9. User Controls

  

   9.1How to handle events from web user controls?
   9.2What ways can users communicate between users controls?
   9.3Is there anything similar to web templates in ASP that I can use in ASP.Net?
   9.4How can I include an Asp.NET page in many other Asp.Net pages so that I don't need to rewrite the code?
   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 add user control dynamically into another usercontrol?
   9.7I have a function inside of the .ascx file. How can I call it from the web application page(the .aspx file)?
   9.8How to pass a parameter to a user control?
   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 group the data in the DataList?
   10.3How to change the colors of a row to indicate its the Birthday of the Employee (for example) in a 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.3How to emit client-side javascript blocks from VB.NET/C#?
   14.4How to open a new Window using javascript function from a Link button?
   14.5Is there a JavaScript Quick Reference Guide?
   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 to show Modal and Modeless dialog windows in Javascript?
   14.12How can I know if the client browser supports active scripting?
   14.13How to determine if the Browser supports javascript?
   14.14How to create files on the client m/c using JavaScript?
   14.15How to parse the files/folders in the client's file system?
   14.16How can i form a regular expression which identifies a valid whole number without decimal places?
   14.17How to check/ uncheck a checkbox based on the text entered in textbox?
   14.18How to rotate a Label Text?
   14.19How to display a message in the status bar of a browser window?
   14.20How to change the BackgroundColor of a page based on the value selected in a DropdownList?
   14.21How to disable a Dropdownlist once someone has selected an item in the Dropdownlist?
   14.22How can I make a Textbox a mandatory field if a checkbox is checked on a button click event in the client side?
   14.23Why does the SmartNavigation does not work on the live server but works perfectly on the Development Machine?
   14.24How to pop up a message box when no item in the dropdownlist is selected before postback?
   14.25How can I use a Timer Control to refresh a page automatically at a specified interval?
   14.26How to open a new window without IE menus and toolbars on click of a button?
   14.27Does JavaScript support hashtables/ hash tables or dictionary type data structures?
   14.28How to disable the right click option on a web page?
   14.29How to hide a control using javascript?
   14.30Can I modify WebUIValidation.js?
   14.31How to change a Label element's text in javascript?
   14.32How to resize two <div> tags on a webform?
   14.33How can I change the scroll bar color?
   14.34How to create dynamic javascripts in server side code based on server side variables?
   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 display the Attribute values in an XML Document in a DataGrid?
   15.7How to use the <asp:xml> tag?

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.3How to create a folder in ASP.NET?
   18.4What is the best way to rename a file on the webserver in code?
   18.5How to delete a file from the server?
   18.6How to find the date and time the specified file or directory was last written to?
   18.7How to get the File information using ASP.NET?
   18.8How to create a .csv file that grabs the data from the database?
   18