Knowledge Base Articles » KB100202: Controlling Web Applications Using the global.asa File.

The global.asa file is a script file that is associated with each Web Application on the Web server. A Web Application is a collection of ASP and HTML pages all contained within a folder on the server. However, not all folders on the Web server are Web Applications.
To determine whether or not a folder is a Web Application, view the properties for the folder in Internet Service Manager on Windows NT. In the "Application Settings" portion of the window, if the "Configuration" button is greyed out, the folder is not a Web Application (you can click the "Create" button to make it a Web Application if you choose). However, if the "Configuration" button is enabled, and there is a "Remove" button above it, then the folder is already a Web Application.
The global.asa file resides in the root folder of a Web Application and is run each time the Application is started or stopped. It is also run each time an individual user starts or ends a browser session that accesses the Application's Web pages.
The global.asa file is therefore used to execute code, initialize variables, connect to databases, or perform any other tasks that need to happen only at the start or end of an Application or Session. This is done by implementing the Application_OnStart, Application_OnEnd, Session_OnStart and Session_OnEnd event handlers. You can find examples of implementing these event handlers in the ASP subdirectory of the DevGuru Technologies section.