Server Object
ASPError Object
All Methods
All Objects
All Properties
METHOD: Server.GetLastError
Implemented in version 3.0
Server.
GetLastError( )
The
GetLastError
method returns an instance of the
ASPError
object. The
ASPError
object exposes (gives access to) nine read-only properties that provide detailed information about an error that has occurred.
Once an ASP file has sent content to a client, you cannot use the
GetLastError
method to access information about the error.
The types of errors handled by the
ASPError
method are called "500;100 custom errors" and there are three major types: pre-processing, runtime, and script compiling.
By default, the error information is sent to the "\iishelp\common\500-100.asp" file. This is a new file that is part of IIS version 5.0 and does not exist in earlier versions. Here is the
source code for the 500-100.asp file.
Since you can access this file, you can customize this code to suit your programming needs.
Also, you can create your own personal, custom ASP error file by having the Internet Information Server (IIS) 5.0 redirect the 500;100 custom errors to an error file that you create. In your ASP error file, you can run any ASP code you desire.
Here is the general concept of how to access the nine
ASPError
properties in an error file
Code:
<%
Dim objErrorInfo
Set objErrorInfo =
Server.GetLastError
Response.Write("ASPCode = " & objErrorInfo.ASPCode)
Response.Write("ASPDescription = " & objErrorInfo.ASPDescription)
Response.Write("Category = " & objErrorInfo.Category)
Response.Write("Column = " & objErrorInfo.Column)
Response.Write("Description = " & objErrorInfo.Description)
Response.Write("File = " & objErrorInfo.File)
Response.Write("Line = " & objErrorInfo.Line)
Response.Write("Number = " & objErrorInfo.Number)
Response.Write("Source = " & objErrorInfo.Source)
%>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information