Building WebApps  «Prev  

Running and managing ASP Application

Web Server is turned on, ASP is running, and the Global.asa file is in the root directory. There are currently no users connected to the website.

A user directs her browser to the home or default page of our web site. ASP automatically runs the Global.asa file. If there is a procedure in Global.asa to run prior to starting the web application (called Application_OnStart), any code in that procedure will be executed.

The first user starts the application and begins her own session. ASP again goes to Global.asa and looks for, and runs, any Session_onStart procedure.

If another user connects to the website while the first user is still on the website, a session is started for this user. Since the application has been started, ASP does not rerun the Application_OnStart procedure. As users connect to and disconnect from the website, additional sessions are created. However, all users share the same application object and application variables.

As user sessions expire, ASP runs the Session_OnEnd procedure, if there is one, in the Global.asa file and shuts down the sessions. The application continues to run as long as at least one user is connected to the website.

When the last user's session expires and ASP has run the Sesion_OnEnd procedure for it, any Application_OnEnd procedure stored in Global.asa is run. The application is terminated and all application variables are erased, although the Web server continues to run.

The website is again ready for the next user(s) to connect to it.