Global.asa Defined
The Microsoft Visual InterDev manual explains the global.asa file as follows:
The Global 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.
Global.asa files can contain only the following:
· Application events
· Session events
· <OBJECT> Declarations
If you include script that is not enclosed by <SCRIPT> 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.
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 <SCRIPT> tags.
Global.asa Example
A global.asa with empty event scripts would look like this:
<script language=vbscript runat=server> SUB Application_OnStart END SUB SUB Application_OnEnd END SUB SUB Session_OnStart END SUB SUB Session_OnEnd END SUB </script>
Global.asa Events
Application_OnStart
The Application_OnStart event is executed the first time that an ASP page within an application is requested.
Session_OnStart
This event is executed for each user when they first request a page within an application.
Session_OnEnd
This event is called when a user's session ends. This could be cause by an explicit end (ie: session.abandon) or the session timeout being exceeded.
Application_OnEnd
This even is called when the application ends. This could be cause by the application being inactive for a period of time or the web site being stopped.
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771