![]() | |||||||||||||||||||||
|
EVENTS The ASP platform allows developers to create Web Applications. In fulfillment of real software requirements, ASP allows event-triggered actions to be taken, which are defined in a global.asa file. The global.asa file resides in the Global directory, defined as a config option , and may define the following actions: Action Event ------ ------ Script_OnStart * Beginning of Script execution Script_OnEnd * End of Script execution Application_OnStart Beginning of Application Application_OnEnd End of Application Session_OnStart Beginning of user Session. Session_OnEnd End of user Session. * These are API extensions that are not portable, but were added because they are incredibly usefulThese actions must be defined in the $Global/global.asa file as subroutines, for example: sub Session_OnStart { $Application->{$Session->SessionID()} = started; }Sessions are easy to understand. When visiting a page in a web application, each user has one unique $Session. This session expires, after which the user will have a new $Session upon revisiting. A web application starts when the user visits a page in that application, and has a new $Session created. Right before the first $Session is created, the $Application is created. When the last user $Session expires, that $Application expires also.
Script_OnStart & Script_OnEnd
The script events are used to run any code for all scripts
in an application defined by a global.asa. Often, you would
like to run the same code for every script, which you would
otherwise have to add by hand, or add with a file include,
but with these events, just add your code to the global.asa,
and it will be run.
Application_OnStart
This event marks the beginning of an ASP application, and
is run just before the Session_OnStart of the first Session
of an application. This event is useful to load up
$Application with data that will be used in all user sessions.
Application_OnEnd
The end of the application is marked by this event, which
is run after the last user session has timed out for a
given ASP application.
Session_OnStart
Triggered by the beginning of a user's session, Session_OnStart
get's run before the user's executing script, and if the same
session recently timed out, after the session's triggered Session_OnEnd.
Session_OnEnd
Triggered by a user session ending, Session_OnEnd can be useful
for cleaning up and analyzing user data accumulated during a session.
|
||||||||||||||||||||
Copyright (c) 1998-1999, Joshua Chamas, Chamas Enterprises Inc. |