ASPError Object

You can use the ASPError object to obtain information about an error condition that has occurred in an ASP script. The ASPError object is returned by the Server.GetLastError method. The ASPError object exposes read-only properties.

ASPError.property

  // Properties
  ASPCode
  Number
  Category
  File
  Line
  Column
  Description
  ASPDescription

Remarks

When IIS encounters an error with either compiling or running an .asp file it will generate a 500;100 custom error. By default all Web sites and applications will transfer processing of a 500;100 custom error to the file 500-100.asp which is installed by default to windir\Help\iisHelp\common. After a 500;100 custom error is generated, IIS will also create an instance of the ASPError object which describes the error condition. The file 500-100.asp uses the properties of this object to display a page describing the error condition. You can develop additional error processing by either modifying 500-100.asp or by creating a new .asp file for processing errors.

Example

The following example is extracted from the file 500-100.asp and demonstrates writing the information exposed by the ASPError object to a table.

<TABLE>
<TR><TD><font style="font:9pt/12pt verdana; color:black">ASP Code        <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.ASPCode %>
<TR><TD><font style="font:9pt/12pt verdana; color:black">Number          <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.Number %> (<%= Hex(e.Number) %>)
<TR><TD><font style="font:9pt/12pt verdana; color:black">Source          <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.Source %>
<TR><TD><font style="font:9pt/12pt verdana; color:black">FileName        <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.FileName %>
<TR><TD><font style="font:9pt/12pt verdana; color:black">LineNumber      <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.LineNumber %>
<TR><TD><font style="font:9pt/12pt verdana; color:black">Description     <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.Description %>
<TR><TD><font style="font:9pt/12pt verdana; color:black">ASP Description <TD><font style="font:9pt/12pt verdana; color:black"> <%= e.ASPDescription %>
</TABLE>

See Also

Server.GetLastError

© 1999 Microsoft Corporation. All rights reserved. Terms of use.