please dont rip this site
Platform SDK: IIS SDK
      [IIS 5.0] [IIS 5.1] [IIS 6.0]

ASPError Object

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

Syntax

ASPError.property

Properties

ASPError.ASPCode Returns an error code generated by IIS.
ASPError.Number Returns the standard COM error code.
ASPError.Source Returns the actual source code, when available, of the line that caused the error.
ASPError.Category Indicates if the source of the error was internal to ASP, the scripting language, or an object.
ASPError.File Indicates the name of the .asp file that was being processed when the error occurred.
ASPError.Line Indicates the line within the .asp file that generated the error.
ASPError.Column Indicates the column position within the .asp file that generated the error.
ASPError.Description Returns a short description of the error.
ASPError.ASPDescription Returns a more detailed description of the error, if it is an ASP-related error

Remarks

When IIS encounters an error either with 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 default .asp file. After a 500;100 custom error is generated, IIS will also create an instance of the ASPError object that describes the error condition.

Example

The following example, extracted from the file 500-100.asp, demonstrates writing the information exposed by the ASPError object.

<%

  Response.Write objASPError.Category

  If objASPError.ASPCode > "" Then Response.Write ", " & objASPError.ASPCode

  Response.Write " (0x" & Hex(objASPError.Number) & ")" & "<br>"



  Response.Write "<b>" & objASPError.Description & "</b><br>"



  If objASPError.ASPDescription > "" Then Response.Write objASPError.ASPDescription & "<br>"



  blnErrorWritten =index.html False



  ' Only show the Source if it is available and the request is from the same machine as IIS

  If objASPError.Source > "" Then

    strServername = LCase(Request.ServerVariables("SERVER_NAME"))

    strServerIP = Request.ServerVariables("LOCAL_ADDR")

    strRemoteIP =  Request.ServerVariables("REMOTE_ADDR")

    If (strServername = "localhost" Or strServerIP = strRemoteIP) And objASPError.File <> "?" Then

      Response.Write objASPError.File 

      If objASPError.Line > 0 Then Response.Write ", line " & objASPError.Line

      If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column

      Response.Write "<br>"

      Response.Write "<font style="index.html"COLOR:000000; FONT: 8pt/11pt courier new""><b>"

      Response.Write Server.HTMLEncode(objASPError.Source) & "<br>"

      If objASPError.Column > 0 Then Response.Write String((objASPError.Column - 1), "-") & "^<br>"

      Response.Write "</b></font>"

      blnErrorWritten = True

    End If

  End If



  If Not blnErrorWritten And objASPError.File <> "?" Then

    Response.Write "<b>" & objASPError.File

    If objASPError.Line > 0 Then Response.Write ", line " & objASPError.Line

    If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column

    Response.Write "</b><br>"

  End If

%>

See Also

Requirements

Platforms: Windows 2000 with IIS 5.0 installed, Windows XP with IIS 5.1 installed, Windows Server 2003 family with IIS 6.0 installed

Platform SDK Release: February 2003
What did you think of this topic?
Order a Platform SDK CD


file: /Techref/language/asp/OBJ/ref_vbom_aseo.htm, 6KB, , updated: 2003/5/15 13:13, local time: 2024/12/19 00:05,
TOP NEW HELP FIND: 
3.147.127.118:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/asp/OBJ/ref_vbom_aseo.htm"> ASPError Object</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .