Global.asa: To be or not to be?
||1/5/2015 2:06:00 PM
Kaustav Acharya (from psc cd)
By 15 Users
||ASP (Active Server Pages), HTML
To educate all coders when or when not to use the 'Global.asa' file and the conditions you must fullfill when you do use it. I knew I had a lot of trouble finding documentation like this. If you like it, please feel free to vote for it. Let me know what I can do to improve myself too, cuz this is my very first tutorial that I wrote. I've been told I'm good at explaining, but let me know ok? :) I'll see if I can dig up any more info on the 'Global.asa' file and try to continue this lesson. The most important reason why I created this tutorial is because most advanced scripts(i.e like my chat script, some database scripts, etc) use it. Very important piece of knowledge to be able to have at your fingertips. Now you can even impress your date with this stuff! ^_^ Not!! Hehe.
Did you use web based
email accounts, shopping bags or online auctions before? If you did , didn't you
ask your self how that web application recognize that this is me when I go from
one page to another inside the site, or how it recognizes what I'm doing and its
me who did that event and not another visitor to the site? How could the site
remember visitors and know if they are still connected or not, or what are they
If they are using IIS the answer probably lies within the
Global.asa, Global.asa is an optional file that can be used to handle
application and session events. For example with the Global.asa help you can do
some function when a new user come to your site and another function when that
user leaves the site. With the session object you can track users and their
events and much more.
Some Facts about Global.asa
¨ The file must be
¨ Global.asa must be
stored in the root directory of the web application.
¨ Global.asa is processed automatically by the server
* The IIS starts and stops.
* Users start and stop sessions that use
the application's web pages.
¨ The scripts
in the Global.asa are used to:
*Initialize application and session
*Connect to databases.
¨ In the Global.asa your script must be enclosed with
the <SCRIPT> tag.
¨ You can use any
supported scripting language to write your scripts inside Global.asa
¨ The IIS/PWS have a build in timelimit (defaulted to
20 minutes), so if the user don't request for any thing for that time limit the
session will be ended automatically.
We use global.asa to make use of the
application and session in the ASP, it can contain four scripts to handle
application and session events.
Application_OnStart :run when IIS/PWS is started
¨ Application_OnEnd :when IIS/PWS is
(Usually the application two scripts are run when the server is
¨ Session_OnStart :run when a
user starts his/hers session
:when the session runs out
(two scripts that are run when a user starts
his/hers session )
Things you must know about Global.asa:
¨ Sessions will only work with visitors that have
¨ If you make a change to
the script. Usually you have to reboot the server to get it refreshed and work
how Global.asa look from inside :
Application_OnStart code will be here
'Your Application_OnEnd code will
'Your Session_OnStart code will be
'Your Session_OnEnd code will be
End of Tutorial
Other 4 submission(s) by this author
Report Bad Submission
Other User Comments
There are no comments on this submission.
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.