global.asa


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
Global.asa

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.

TIP


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.

Note

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.

Editor

Articles posted after being checked by editors.

Recent Content

link to Public Key Infrastructure (PKI)

Public Key Infrastructure (PKI)

Public Key Infrastructure, also known as PKI, is a set of services that support the use of public-key cryptography in a corporate or public setting. A public key infrastructure (PKI) enables key pairs to be generated, securely stored, and securely transmitted to users so that users can send encrypted transmissions and digital signatures over distrusted public networks such as the Internet.
link to Digital Signature

Digital Signature

Digital Signature is an electronic signature that you can use to sign a document being transmitted by electronic means such as e-mail. Digital signatures validate the identity of the sender and ensure that the document they are attached to has not been altered by unauthorized parties during the transmission.