Global Error Handling in IIS5 with Mail Notify

In this tutorial I will explain how to easy it is to make a global error page that will be displayed each time an error occurs. Here are some objectives we will try to archive:

  • The page should be executed on each ASP error
  • The error page will be customized to the appearance of the site.
  • An e-mail shall be sent to the administrator when the error page executes to inform him about the error.

This is a very neat solution because we don't want to have a very extended error handling on each page. And even if we put such handling on each page - there are so many errors that can occur - we will never be able to handle them all.

Global Error Handling in IIS5 with Mail Notify

 

Overview

In this tutorial I will explain how to easy it is to make a global error page that will be displayed each time an error occurs. Here are some objectives we will try to archive:

  • The page should be executed on each ASP error
  • The error page will be customized to the appearance of the site.
  • An e-mail shall be sent to the administrator when the error page executes to inform him about the error.

This is a very neat solution because we don't want to have a very extended error handling on each page. And even if we put such handling on each page - there are so many errors that can occur - we will never be able to handle them all.

 

How is it done?

The global error handling is done by a new setting in IIS5. There you can assign an ASP page to handle specific error.

In the current tutorial we will only handle ASP errors - those have HTTP error code 500-100.
Other HTTP errors like 404 - file not found and other we will leave to you.

 

Lets get started!

Ok, enough talking now lets see how this is done:

 

Create an ASP page that will handle all your errors.

You could use the page I've made (download it here) :

  • change its design to fit your site.
  • Change the e-mail addresses in it. To get the Mail notify working.
    Note that I'm using CDO mail for now.
  • Save this page somewhere in your site Save it as 500-100.asp.I prefer the root directory, so the virtual path to it becomes: /500-100.asp

NOTE: I've also included an ASP page that generates an error so you can try your own creation when you are done. Its called makeerror.asp - save it on your website too for testing.

Then you have to change some settings on your IIS

 

Open IIS Manager, Right click on your site, then select Properties.

 

On the Properties dialog, choose the Custom Errors tab.

There you see a full list of all possible errors. Remember we are going to change only the ASP generated errors (500-100)

Choose error 500;100 then Edit Properties

  • Message Type: URL
  • URL is /500-100.asp (where you save the global error page on your site)

Click OK, and accept everything.

 

That's All - Have fun!

Download supporting material here

George Petrov

George PetrovGeorge Petrov is a renowned software writer and developer whose extensive skills brought numerous extensions, articles and knowledge to the DMXzone- the online community for professional Adobe Dreamweaver users. The most popular for its over high-quality Dreamweaver extensions and templates.

George is also the founder of Wappler.io - the most Advanced Web & App Builder

See All Postings From George Petrov >>

Comments

Be the first to write a comment

You must me logged in to write a comment.