what is custom error page?

A custom error page is a feature of most Web server software that allows you to replace default error messages with the one you create. The default error messages tend to be fairly generic, and not particularly user-friendly, so making custom messages for your site is recommended.

ASP.NET provides a simple yet powerful way to deal with errors that occur in your web applications. It can be configured in the customErrors section of web.config.

Set the customErrors mode to On or RemoteOnly, and specify the defaultRedirect attribute, this attribute contains the error page to which the user will be redirected. Additionally you can take custom error handling a step further by associating specific errors with specific error pages. The customErrors section can contain error elements that associate particular errors with error pages.

For example, in the following code:

<customErrors mode="RemoteOnly" defaultRedirect="apperror.aspx">
<error statusCode="404" redirect="404.aspx">
<error statusCode="500" redirect="500.aspx">

404-Page Not Found errors are associated with 404.aspx while 500-InternalServer Errors are associated with 500.aspx. Finally, the defaultRedirect attribute associates any other error with the apperror.aspx page.

Spot an error? Please comment about this article

Keywords: Hot Tip - ASP.NET  SSW Link Auditor    

New Search SSW Custom Support