2025-04-27 07:49:33 -04:00

123 lines
4.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>GetLastError</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H4><A NAME="_getlasterror"></A><SUP></SUP>GetLastError</H4>
<P>The <B>GetLastError</B> method returns an <A HREF="/iishelp/iis/htm/asp/vbob1dtg.htm"><B>ASPError Object</B></A> describing the error condition that occurred. This method is available only before the .asp file has sent any content to the client.</P>
<H6>Syntax</H6>
<P><B>Server.GetLastError</B> <B>()</B></P>
<P><B>&nbsp;</B></P>
<H6>Remarks</H6>
<P>If a 500;100 custom error has been defined for an ASP application, it may refer to an .asp file. In this case, when an error occurs during the running of an .asp file within the application, the server will automatically transfer to this ASP page via the <A HREF="/iishelp/iis/htm/asp/vbob9waa.htm"><B>Server.Transfer</B></A> method. All of the state information from the executing ASP application will be available to the .asp file that is handling the error. In addition, the <A HREF="/iishelp/iis/htm/asp/vbob1dtg.htm"><B>ASPError</B> <B>Object</B></A> will be available, so you can expose the properties of the error through the .asp file that you set up to handle the error.</P>
<P>The default Web site is configured to use the file \iishelp\common\500-100.asp. You can either use this file for processing ASP errors, or create your own. If you want to change the .asp file for processing the 500;100 custom errors you can use the Internet Information Services snap-in. For more information see <A HREF="../core/iiprstop.htm">Enabling ASP Error Processing</A>.</P>
<P><span class=le><B>Note&nbsp;&nbsp;&nbsp;</B></span>A 500;100 custom error will be generated if IIS encounters an error while processing either an .asp file or the application's Global.asa file. </P>
<H6>Example</H6>
<P>The following three examples demonstrate different sorts of errors that will generate a 500;100 custom error. The three types of errors are:
<UL type=disc>
<LI>Pre-processing errors</li>
<LI>Script compiling errors</li>
<LI>Run-time errors</li>
</UL>
<P>The first example demonstrates a pre-processing error, which IIS will generate when it tries to include the file. This error will be generated because the include statement is missing the file parameter for the include statement. The second example demonstrates a script compiling error. The scripting engine will not compile this script because it is missing the keyword "next" in a <B>For...Next</B> loop. The third example demonstrates a run-time error that will be caught because the script attempts to divide by 0. </P>
<P>Example 1</P>
<PRE><CODE>&lt;!--#include fil=inc.h --&gt;
&lt;%
response.write "hello"
%&gt;
</CODE></PRE>
<P>Example 2</P>
<PRE><CODE>&lt;%
dim I
for i=1 to 1
nxt
%&gt;
</CODE></PRE>
<P>Example 3</P>
<PRE><CODE>&lt;%
dim i,j
dim sum
sum=0
j=0
for i=1 to 10
sum=sum+1
next
sum=sum/j
%&gt;
</CODE></PRE>
<H6>Applies To</H6>
<P><A HREF="/iishelp/iis/htm/asp/vbob7838.htm"><B>Server</B> Object</A></P>
<H6>See Also</H6>
<P><A HREF="/iishelp/iis/htm/asp/vbob1dtg.htm"><B>ASPError</B> Object</A></P>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>