I.T. Discussion Community!
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

August Edition
Subscribe now! It's Free!
Enter your email:

   ► KBWebsite Scri...ASP Classic   Print This     
  From the December 2009 Issue of Prestwood eMag
 
ASP Classic:
Global.asa Overview
 
Posted 15 years ago on 3/19/2003
Take Away: Introduction to the global.asa file.

KB100169



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.


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1154A1
Enter key:
KB Post Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100169 Counter
3672
Since 4/2/2008
-
   Contact Us!
 
PrestwoodBoards.com was developed and is maintainted by me. Do you have a question or suggestion? Do you see a problem? Contact me now. My goal is to build an ad-free and spam-free source of I.T. information with many contributers (ok to promote your website/company in your bio). Yes, my company Prestwood IT Solutions is mentioned in my bio which shows with every post, but you can contribute and promote your pet project too!

1,693 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...


©1995-2018 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech