Internet

Active Server Pages Tutorial

The ASPError Object

The ASPError object, implemented in ASP 3.0, is used to return detailed information about an error occurring on a page. The object is created by the Server.GetLastError() method. Note: The ASPError object can only be used with IIS5.

ASPError Object: Properties
ASPCode Returns the error code.
ASPDescription Returns a description of an ASP error.
Category Returns the source of the error.
Column Returns the column in the file where the error occurred.
Description Returns a brief description of the error.
File Returns the name of the file where the error occurred.
Line Returns the line number where the error occurred.
Number Returns the COM error code.
Source Returns the source code of the line containing the error.

To use the ASPError object, you must first create the object using the Server.GetLastError() statement. Then you can access any of the object’s properties, such as Source and Description:

<% Dim ErrorInfo Set ErrorInfo=Server.GetLastError() Response.Write(“Source: ” & ErrorInfo.Source & ” “) Response.Write(“Description: ” & ErrorInfo.Description & ” “) %>