Customizing Error Pages
page 2 of 3
by Steven Swafford
Feedback
Average Rating: 
Views (Total / Last 10 Days): 21154/ 55

Error Handling At The Application Level

The first two items we are going to discuss is error handling using the web.config and the global.asax files.

Custom errors are beneficial in many aspects. You can either hide errors or provide a more detailed error messages. To utilize custom errors you must use the customErrors section within your web.config file.

Example:
<configuration>
<system.web>
<customErrors mode="on" defaultRedirect="MyApplicationError.aspx">
<error statusCode = "404" redirect="My404.aspx">
' Feel free to add other error types…
</customErrors>
</system.web>
</configuration>

If you prefer there is another option that you may use on a page to page basis.

Example:
<%@ Page ErrorPage=" MyApplicationError.aspx" %>

As indicated the global.asax can also be used to assist you in error handling. One beneficial item you could do here is to establish a method that that will send out an email to an individual or individuals when an error occurs. This way you can be proactive and tackle the issue when it arises.

At this point you time you should understand the basics of using of the try...catch...finally blocks for wrapping statements that could fail and the use of the web.config and global.asax files to assist in error handling.


View Entire Article

User Comments

Title: Very good info, thanks   
Name: Joe
Date: 2004-06-14 4:49:41 AM
Comment:
This was very helpful for me.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-11-20 8:00:14 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search