![]() | Pepper Spray & Stun Gun Specials! KEEP THEM SAFE. | |
| CoverYourASP --> Trapping HTTP 500.100 - Internal Server Error --> Part 2 | ||
| The Handle500100.asp fileThe error handling file is just a normal ASP file. What makes it useful is the use of the Server.GetLastError() method to inform both the user and I (via email) what went wrong. We'll look at that code in a minute. Just as when an HTTP 404, File not found error occurs, it is a very good idea to apologise profusely and offer your reader some options. To see my handler in action, here's a link to the Test500100.asp file that contains the errors. As you can see, I try to keep the user as happy as possible. The error page looks like any other page on the site, apologises and tries to keep the user from leaving the site in disgust. The Server.GetLastError method
The handler wouldn't be very useful if it didn't tell me quickly what was wrong, so I can fix it. An example of the error I get is shown above, with the code to create it shown below: (As always, you can get the entire source code by clicking on the icon at the end of the article).
Fairly self-explanatory I hope, and lifted almost verbatim from IIS's default 500 handler. Hey, it's going to work, right? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||