<html>
<head>
<title>ASPError Object</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">ASPError Object</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">


<p><!--<primary>ASPError object</primary>-->
<!--<primary>errors</primary><secondary>handling
of</secondary>-->Introduced with ASP 3.0, the built-in
ASPError object allows you to view detailed information about the
last error that occurred in the script of an ASP page in the current
session. This object, through its nine read-only properties, provides
more detailed information about the type and source of errors than
does the Err object provided in VBScript.</p>




<p>To use the ASPError object and its properties, you must call a new
method of the Server object, <!--<primary>GetLastError
method</primary><secondary>ASPError
object</secondary>-->GetLastError, which returns an
ASPErrorObject with its properties' values set to reflect
details about the last error that occurred in the script:</p>




<span class="PROGRAMLISTING"><pre>Dim objMyASPError
Set objMyASPError = Server.GetLastError</pre></span>




<p>When you install <!--<primary>IIS (Internet Information
Server)</primary><secondary>errors and</secondary>-->IIS
5.0, by default, all preprocessing, script and runtime errors in ASP
code cause IIS to stop processing the current script and redirect
script execution to a custom error page named
<filename>500-100.ASP</filename>. This redirection occurs through an
internal call to the Server.Transfer method which, as detailed in
<link linkend="ch09-1-fm2xml">Chapter 9</link>, shifts execution from one script to
another while protecting all state information available in the first
script.</p>




<p>The <filename>500-100.ASP</filename> script (located by default in
the <filename>C:\WINNT\Help\iisHelp\common </filename>directory)
contains a call to the Server.GetLastError method. When this script
is executed, it formats and displays the current property values of
the ASPError object returned by this call to GetLastError.</p>




<p>You can use the default error page, <filename>500-100.ASP</filename>,
as-is; edit it to reflect your site's look and feel; or use the
Internet Services Manager snap-in to redirect IIS to a page of your
choosing (see <link linkend="appd-1-fm2xml">Appendix D</link>).</p>




<p>The properties, collections, methods, and events of the ASPError
object are outlined in the following box.</p>




<!--
<p class="TITLE">ASPError Object Summary</p>




<dl>
<dt>Properties</dt>
<dd><p>ASPCode</p>






<p>ASPDescription</p>




<p>Category</p>




<p>Column</p>




<p>Description</p>




<p>File</p>




<p>Line</p>




<p>Number</p>




<p>Source</p>
</dd>





<dt>Collections</dt>
<dd><p>None</p></dd>







<dt>Methods</dt>
<dd><p>None</p></dd>







<dt>Events</dt>
<dd><p>None</p></dd>

</dl>



-->
</td></tr>
</table>
</div>
<div id="CommentsTroubleshooting">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Comments/Troubleshooting</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">

<p><!--<primary>comments and
troubleshooting</primary><secondary>ASPError
object</secondary>-->Many beginning ASP developers use the
following code to enable debugging of their scripts using the Err
object in VBScript:</p>




<span class="PROGRAMLISTING"><pre>On Error Resume Next</pre></span>




<p>If you include this line of code in your script, then only
preprocessing and script (syntax) errors will cause IIS to call the
Server.Transfer method and redirect script execution to your
<filename>500-100.ASP</filename> script (or custom error-handling
script). Runtime errors will not cause IIS to transfer processing to
<filename>500-100.ASP</filename>. For example, if you use this line
of debugging code, you will not necessarily catch the error in the
following block of code:</p>




<span class="PROGRAMLISTING"><pre>Dim intCounter
For intCounter = 1 to 100
     intResult = intCounter / (intCounter - 100)
Next</pre></span>




<p>In this snippet, you would have to add code before the
<span class="LITERAL">Next</span> statement to catch the division by zero error
that will arise when <var class="replaceable">intCounter</var> is 100.
Adding these lines to catch errors throughout your code is costly in
processing time and error-prone in its own right, since you have to
anticipate the line on which an error is likely to occur in order to
effectively trap it. As a result, and because the ASPError object
provides more information than the Err object, you should not use
<span class="LITERAL">On Error Resume Next</span> if you can avoid it.</p>




<p>Another excellent use of the ASPError object page,
<filename>500-100.ASP</filename> (or similar, customized scripts for
errors) is to handle errors that occur in a publicly available site.
For example, you could customize the <filename>500-100.ASP</filename>
script to contain your site's color scheme and background and
to include a Help phone number that could connect the user
experiencing difficulty with someone who could help. And support
personnel can field the call more effectively if you take advantage
of the more extensive range of information that the ASPError object
can provide to the <filename>500-100.ASP</filename> script.</p>




<p>Another possibility is to use <filename>500-100.ASP</filename> to
route an error notification to the appropriate personnel "in
the background," and to hide the details of the error from the
end user. This version of <filename>500-100.ASP</filename> would
simply display the fact that an error has occurred and that the user
should try his or her action later, while—in the
background—sending an error email to support personnel. An
example script that performs these functions can be found at the end
of this chapter.</p>




<p>The code examples that illustrate the properties of the ASPError
object all make use of three different error-generating scripts. The
first contains a syntax error, the second contains an error in a
preprocessing directive, and the third generates a runtime error.
While the examples all make use of the same three ASP pages to
generate errors, it is the contents of the custom error page
<filename>500-100.ASP</filename> that change to illustrate the
particular property. The three ASP pages that raise errors are the
following:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Error Generating Script #1 ****
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;
Error Generation Page #1
&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;%
' This page contains a syntax error.
' In the following For...Next loop, the keyword
' "For" is mispelled.
Dim intCounter
<strong class="userinput">Fir</strong> intCounter = 1 to 100
%&gt;
Look everyone! I'm counting: &lt;%=intCounter%&gt;&lt;BR&gt;
&lt;%
Next
%&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
**** END Error Generating Script #1 ****


**** BEGIN Error Generating Script #2 ****
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;
Error Generation Page #2
&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;%
' This page contains a preprocessing error.
' The work "file" in the #INCLUDE preprocessor 
' directive is mispelled:
%&gt;
&lt;!--#include <strong class="userinput">fil</strong>=/headers/AdminHeader.INC --&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
**** END Error Generating Script #2 ****


**** BEGIN Error Generating Script #3 ****
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;
Error Generation Page #3
&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;%
' This page contains a runtime error.
' In the following For...Next loop, when the
' intCounter variable gets to zero, the result
' is a divide by zero error.
Dim intCounter
Dim dblDivResult
For intCounter = 1 to 100
     dblDivResult = <strong class="userinput">intCounter / (intCounter - 100)</strong>
%&gt;
Look everyone! I'm dividing: &lt;%=dblDivResult%&gt;&lt;BR&gt;
&lt;%
Next
%&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
**** END Error Generating Script #3 ****</pre></span>
</td>
</tr>
</table>
</div>
<div id="ASPCode">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
ASPCode</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.ASPCode</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>ASPCode property
(ASPError)</primary>-->ASPCode property holds a numeric code
representing the ASP-specific error that occurred in the script that
raised the error. This property is populated by IIS if the error
occurred in processing the ASP script.</p>




<p>The ASPCode property is read-only.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example assumes that the following code has been added to the
default custom error script, <filename>500-100.ASP, </filename>and
that each of the three scripts shown at the end of the
Comments/Troubleshooting section is used to raise an error that
invokes it:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN ASPCode Example Script ****
&lt;%
' This script demonstrates the use of the ASPCode
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the ASPCode property is " &amp; objMyASPError.ASPCode
%&gt;
**** END ASPCode Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding example
script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPCode property is [EMPTY]</pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPCode property is <strong class="userinput">ASP 0128</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPCode property is [EMPTY]</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>As previously noted, the ASPCode property is not populated unless the
error occurred when interpreting the ASP script itself. This covers
all preprocessing directives.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="ASPDescription">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
ASPDescription</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.ASPDescription</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>ASPDescription property
(ASPError)</primary>-->ASPDescription property is a string
value that IIS populates upon encountering an ASP error. It provides
more descriptive data about the type of ASP error that occurred than
does the ASPCode property. As with the ASPCode property, the
ASPDescription property is only populated if the error that occurs is
part of the interpretation of an ASP script, rather than as a result
of a runtime error.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN ASPDescription Example Script ****
&lt;%
' This script demonstrates the use of the ASPDescription
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the ASPDescription property is " &amp; _
     objMyASPError.ASPDescription
%&gt;
**** END ASPDescription Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding
ASPDescription script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPDescription property is [EMPTY]</pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPDescription property is <strong class="userinput">The Include file name must be 
specified using either the File or Virtual attribute.</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the ASPDescription property is [EMPTY]</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Like ASPCode, the ASPDescription property is only useful for ASP
interpretation-specific errors. The Description property of the
ASPError object almost always provides the same or better information
about the most recent error.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Category">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Category</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Category</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Category property
(ASPError)</primary>-->Category property holds a string that
specifies the type of error that has occurred: IIS-specific,
scripting language specific, or component specific.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
example code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Category Example Script ****
&lt;%
' This script demonstrates the use of the Category
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Category property is " &amp; objMyASPError.Category
%&gt;
**** END Category Example Script ****</pre></span>




<p>When the error-generating scripts are executed, this script generates
the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Category property is <strong class="userinput">Microsoft VBScript compilation</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Category property is <strong class="userinput">Active Server Pages</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Category property is <strong class="userinput">Microsoft VBScript runtime</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Category property allows you to narrow down where to look for the
error.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Column">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Column</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Column</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Column property</primary><secondary>ASPError
object</secondary>-->Column property holds a long value that
specifies the specific character column containing the first
character of the error-causing code.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Column Example Script ****
&lt;%
' This script demonstrates the use of the Column
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Column property is " &amp; objMyASPError.Column
%&gt;
**** END Column Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding Column
script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Column property is <strong class="userinput">19</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Column property is <strong class="userinput">-1</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Column property is <strong class="userinput">-1</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Column property is valuable in helping you locate erroneous
syntax in your code. However, if the error is ASP-specific or the
location where the error arises does not contain syntactically
incorrect code, this value is -1 and, as such, is of limited use.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Description">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Description</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Description</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Description
property</primary><secondary>ASPError
object</secondary>-->Description property is a string
describing the last-occurring error. It is typically more descriptive
and useful than the related ASPDescription property, except when the
error is ASP interpretation-specific.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Description Example Script ****
&lt;%
' This script demonstrates the use of the Description
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Description property is " &amp; objMyASPError.Description
%&gt;
**** END Description Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding
Description script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Description property is <strong class="userinput">Expected end of statement</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Description property is <strong class="userinput">Missing File or Virtual attribute</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Description property is <strong class="userinput">Division by zero</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Description property value is typically more descriptive than the
other properties of the ASPError object. However, like all the other
properties, it is of very little use to the end users of your ASP
application. As such, it is important that any information you
display explaining the cause of the error be informative or useful to
the user. At the end of this chapter is an example of a customized
<filename>500-100.ASP</filename> script that you can use to display
innocuous error information while still providing useful information
to the developer of the script.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="File">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
File</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.File</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>File property
(ASPError)</primary>-->File property contains the full path
to the file containing the error-producing code. This filename
contains the full path of the file from the web root.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN File Example Script ****
&lt;%
' This script demonstrates the use of the File
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the File property is " &amp; objMyASPError.File
%&gt;
**** END File Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding File
script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the File property is <strong class="userinput">/errorgen1.asp</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the File property is <strong class="userinput">/errorgen2.asp</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the File property is <strong class="userinput">/errorgen3.asp</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Note that the file path is listed from the web server's root
path, not from the root of the current application.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Line">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Line</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Line</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Line property</primary><secondary>ASPError
object</secondary>-->Line property is a long value
representing the line number where the error-producing code occurs.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Line Example Script ****
&lt;%
' This script demonstrates the use of the Line
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Line property is " &amp; objMyASPError.Line
%&gt;
**** END Line Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding Line
script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Line property is <strong class="userinput">11</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Line property is <strong class="userinput">11</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Line property is <strong class="userinput">14</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The line count starts with the very first ASP line of code and begins
with 1.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Number">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Number</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Number</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Number property</primary><secondary>ASPError
object</secondary>-->Number property contains a long value
that represents an error code returned by a COM component. This long
value will be a standard COM error code.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Number Example Script ****
&lt;%
' This script demonstrates the use of the Number
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Number property is " &amp; objMyASPError.Number
%&gt;
**** END Number Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the following three
responses are generated:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Number property is <strong class="userinput">-2146827263</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Number property is <strong class="userinput">-2147467259</strong></pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Number property is <strong class="userinput">-2146828277</strong></pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Source">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Source</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">objASPError.Source</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The <!--<primary>Source property</primary><secondary>ASPError
object</secondary>-->Source property is a string containing
the line of code that caused the most recent error, if that code was
syntactically incorrect.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>This example uses the error-generating scripts listed at the end of
the Comments/Troubleshooting section. It assumes that the following
code has been added to the default custom error script,
<filename>500-100.ASP</filename>:</p>




<span class="PROGRAMLISTING"><pre>**** BEGIN Source Example Script ****
&lt;%
' This script demonstrates the use of the Source
' property of the ASPError object.
Dim objMyASPError

Set objMyASPError = Server.GetLastError( )

Response.Write "The value of the Source property is " &amp; objMyASPError.Source

%&gt;
**** END Source Example Script ****</pre></span>




<p>When the error-generating scripts are executed, the preceding Source
script generates the following three responses:</p>




<p>Error Generating Script #1:</p>




<span class="PROGRAMLISTING"><pre>The value of the Source property is <strong class="userinput">Fir intCounter = 1 to 100</strong></pre></span>




<p>Error Generating Script #2:</p>




<span class="PROGRAMLISTING"><pre>The value of the Source property is [EMPTY]</pre></span>




<p>Error Generating Script #3:</p>




<span class="PROGRAMLISTING"><pre>The value of the Source property is [EMPTY]</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>As mentioned previously, the Source property is only useful if the
error produced is syntax-related. Otherwise, this property is empty.</p>



</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>