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

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.

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

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

<%@ 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
This was very helpful for me.

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

©Copyright 1998-2024  |  Page Processed at 2024-05-29 11:34:52 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search