Help for those looking for Custom Error Handling with ASP.NET

I have been learning about Custom Error pages and ASP.NET websites.
Build Your Own ASP.NET Website Using C# & VB.NET
The following seem to be a requirement:

  • You need a Global.asax file to catch the error properly and generically, see notes below(#)
  • You need to modify your web.config file
  • It is a good idea to display a user friendly error screen, that at the same time notifies the webmaster somehow
Here are a few links that I would recommend reading, and even using their code as a starter:






Sure you could have googled them yourself, but I have found a trick when searching for goodies on ASP. Enter in your search query proceeded by MSDN, and you get better results.

#Some notes on Gloval.asax

To add a Global.asax file to your project. Go to root of the Website, right click -> Add New Item (or menu Website->Add Item) and find the icon that says Global Application Class. Add this item, and then insert the code into its text. If you are using a web application project, use the code-behind file.

Comments