How to catch the 404 error in my web application and provide more useful information?
In the global.asax Application_error Event write the following code VB.NET Dim ex As Exception = Server.GetLastError().GetBaseException() If TypeOf ex Is System.IO.FileNotFoundException Then ’your code ’Response.Redirect(‘err404.aspx’) Else ’your code End If C# Exception ex = Server.GetLastError().GetBaseException(); if (ex.GetType() == typeof(System.IO.FileNotFoundException)) { //your code Response.Redirect (‘err404.aspx’); } else { //your code }
How to access the Parameters passed in via the URL
Call the Request.QueryStringmethod passing in the key. The method will return the parameter value associated with that key. VB.NET Request.QueryString(‘id’) C# Request.QueryString[‘id’];
What is a ViewState
In classic ASP, when a form is submitted the form values are cleared. In some cases the form is submitted with huge information. In such cases if the server comes back with error, one has to re-enter correct information in the form. But submitting clears up all form values. This happens as the site does not maintain any state (ViewState). In ASP .NET, when the form is submitted the form reappears in the browser with all form values. This is because ASP .NET maintains your ViewState. ViewState is a state management technique built in ASP.NET. Its purpose is to keep the state of controls during subsequent postbacks by the same user. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat=’server’> control. <input type=’hidden’ name=’__VIEWSTATE’ value=’dDwyNTA3OTU0NDM7Oz7t5TntzkOUeB0QVV6FT2hvQwtpPw==’ /> If you want to NOT maintain the ViewState, include the directive <%@ Page EnableViewState=’false’%> at the top of an .aspx page If you do not want to maintain Viewstate for any control add the attribute EnableViewState=’false’ to any control. For more details refer The ASP.NET View State
Why does my ASP.NET file have multiple <form> tag with runat=server?
This means that ASP.Net is not properly registered with IIS. .Net framework provides an Administration utility that manages the installation and uninstallation of multiple versions of ASP.NET on a single machine. You can find the file in C:\WINNT\Microsoft.NET\Framework\v**\aspnet_regiis.exe use the command: aspnet_regiis.exe -u —> to uninstall current asp.net version. use the command: aspnet_regiis.exe -i —> to install current asp.net version. For Windows Server 2003, you must use aspnet_regiis -i -enable This is because of the ‘Web Service Extensions’ feature in IIS 6 (if you install VS.NET or the framework without IIS installed, and then go back in and install IIS afterwards, you have to re-register so that ASP.NET ’hooks’ into IIS properly.’
Why does the SmartNavigation does not work on the live server but works perfectly on the Development Machine
May be the domain does not have access to the aspnet_client folder which is located in the wwwroot folder. i.e the website is not able to find the scripts for smart navigation. So set up a virtual folder to the wwwroot/aspnet_client and it will fix the problem.