ASP.net has its own built-in error handling. To set up custom error handling for your ASP.net application, you will need to modify your web.config file.
As an example, if you want to redirect all 404 errors to error404.aspx, 500 errors to error500.aspx, and all other errors to error.htm, you would update the customErrors element in your web.config as follow :
<CONFIGURATION>
<SYSTEM.WEB>
<CUSTOMERRORS defaultRedirect="~/errors/error.aspx" mode="On" />
<ERROR redirect="~/errors/error400.aspx" statusCode="404" />
<ERROR redirect="~/errors/error500.aspx" statusCode="500" />
SYSTEM.WEB>
CONFIGURATION>
CustomErrors is set to Off by default on all our servers. If you do not customize the custom error element in the web.config file, the default ASP.net error (with debug information) will be displayed.
For more information about this custom error customize, please refer following site :
- http://aspnetresources.com/articles/CustomErrorPages.aspx