Last Edited



Definition of global.asa file in Network Encyclopedia.

What is global.asa?

Global.asa is a file used in Active Server Pages (ASP) applications running on Microsoft Internet Information Server or Internet Information Services that contains information global to all pages in the application. Global.asa does not generate content visible to the client Web browser – any Hypertext Markup Language (HTML) in the global.asa file is ignored by the server.

Global.asa file example

The global.asa file can contain object declarations using <OBJECT> tags, type library declarations for COM components that your application uses, and application and session events. You can have only one global.asa file per ASP application.

Global.asa files can contain only the following:

  • ASP Built-in Object Events (one each of Application_OnStart, Application_OnEnd, Session_OnStart, and Session_OnEnd)
  • OBJECT Declarations
  • TypeLibrary 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.

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.

After all of the current user requests have been processed, the server deletes all active sessions, calling the Session_OnEndevent for each session it deletes, closes the application, and calls the Application_OnEnd event. The Global.asa file is then recompiled. Subsequent user requests will start the application and create new sessions, and trigger the Application_OnStart and Session_OnStart events.

Procedures declared in the Global.asa file can be called only from one or more of the scripts associated with the Application_OnStartApplication_OnEndSession_OnStart, and Session_OnEnd events. They are not available to the ASP pages in the ASP-based application.

To share procedures across an application, you can declare the procedures in a separate ASP file, and then use Server.Transfer Method and Server.Execute Method. You can also use server-side include (SSI) statements to include the file in the ASP pages that call the procedures.


If your global.asa file generates an error, you should ensure that any object declarations within the file have application-level or session-level scope, that any script in the file is enclosed within <SCRIPT> tags, and that any <OBJECT> tags are placed outside of <SCRIPT> tags.


To increase security on you Web server, do not store sensitive data in include files. If you do store sensitive data in include files, change the IIS script mapping for the .inc extension from ssinc.dll to asp.dll so that ASP can throw an exception if an invalid character is passed. Alternatives to using #include in ASP applications are Server.Transfer Method and Server.Execute Method.