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

80 lines
5.1 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>Global.asa Reference</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">
<H1><A NAME="_global.asa_reference"></A><SUP></SUP>Global.asa Reference</H1>
<P>The Global.asa file is an optional file in which you can specify event scripts and declare objects that have session or application scope. It is not a content file displayed to the users; instead it stores event information and objects used globally by the application. This file must be named Global.asa and must be stored in the root directory of the application. An application can only have one Global.asa file.</P>
<P>Global.asa files can contain only the following:
<UL type=disc>
<LI><A HREF="/iishelp/iis/htm/asp/glob3gj7.htm">Application Events</A></li>
<LI><A HREF="/iishelp/iis/htm/asp/glob5j03.htm">Session Events</A></li>
<LI><A HREF="/iishelp/iis/htm/asp/glob822b.htm">&lt;OBJECT&gt; Declarations</A></li>
<LI><A HREF="/iishelp/iis/htm/asp/glob4b5f.htm">TypeLibrary Declarations</A></li>
</UL>
<P>If you include script that is not enclosed by &lt;SCRIPT&gt; tags, or that defines an object that does not have session or application scope, the server returns an error. The server ignores both tagged script that the application or session events do not use, as well as any HTML in the file.</P>
<P>The scripts contained in the Global.asa file may be written in any supported scripting language. If multiple event or object scripts use the same scripting language, they can be combined inside a single set of &lt;SCRIPT&gt; tags.</P>
<P>When you save changes to the Global.asa file, the server finishes processing all of the current application requests before it recompiles the Global.asa file. During that time, the server refuses additional requests and returns an error message stating that the request cannot be processed while the application is being restarted.</P>
<P>After all of the current user requests have been processed, the server deletes all active sessions, calling the <B>Session_OnEnd</B> event for each session it deletes, closes the application, and calls the <B>Application_OnEnd</B> event. The Global.asa file is then recompiled. Subsequent user requests will start the application and create new sessions, and trigger the <B>Application_OnStart</B> and <B>Session_OnStart</B> events.</P>
<P>Procedures declared in the Global.asa file can only be called from one or more of the scripts associated with the <B>Application_OnStart</B>, <B>Application_OnEnd</B>, <B>Session_OnStart</B>, and <B>Session_OnEnd </B>events. They are not available to the ASP pages in the ASP-based application. </P>
<P>To share procedures across an application, you can declare the procedures in a separate file, and then use server-side include (SSI) statements to include the file in the ASP pages that call the procedures. You typically give include files an .inc extension.</P>
<P><span class=le><B>Note&nbsp;&nbsp;&nbsp;</B></span>The examples in this document use Microsoft<sup>&reg;</sup> Visual Basic<sup>&reg;</sup> Scripting Edition (VBScript) as the primary scripting language. However, ASP scripts can be written in any supported scripting language, such as JScript<sup>&reg;</sup>. For more information on how to change the primary language, see <A HREF="iiwascln.htm">Working with Scripting Languages</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>