ASPError Example

The following script could be used as a custom version of 500-100.ASP. It demonstrates several of the items discussed in this chapter and others.

From the user's perspective, this script simply informs him or her that an error has occurred, that the developers of the application have been notified, and that the user should try his or her action again later. It also provides a number that the user can call for support. In the background, however, this script creates a mail message containing information about the offending error, the state of the application and about the specific user who was attempting the action in the application. This mail message is then routed to a developer mailbox.

Note that you could add more sophistication to the routing mechanism that could, for example, look up the appropriate recipient based on the script title. Also, you may want to log these error messages in a database for later review.

<%@ LANGUAGE="VBSCRIPT" %> <% Response.Buffer = TRUE Response.Expires = 0 ' Script Name: 500-100_Custom.ASP ' Description: This script catches the last error and ' creates and sends a message via email ' to the responsible developer. ' Inputs: Will take whatever information was previously ' submitted into the error-raising script. ' Author: Keyton Weissinger ' Change Log: ' Date Programmer Notes ' --------------------------------------------------- ' 3/24/2000 AKW Created script. ' *** Dimension local variables needed for script. *** ' Vars for user ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.