Maintaining Session State With ASP - The Application Object (Page 3 of 5 )
The Application object is used to store variables and to access variables from any page. All users share one Application object.
All variables created within the application object have application level scope, meaning that they are accessible to all users who visit your site. All ASP pages in a virtual directory and its subdirectories come under the application scope, so more than one user shares application level variables at any time.
Lock: Prevents other users from changing the application objects properties
Unlock: Allows other users to change the application objects properties
Application_OnEnd: This routine is called when all user sessions expire and the application quits. This event lives in the global.asa file, which we will look at shortly.
Application_OnStart: This routine is called when the application object is first references. This event lives in the global.asa file as well.
This example uses an application variable to determine the uptime of the server. To achieve this we simply add an application variable to the OnStart event in the global.asa file, which needs to exist in the root directory of your web server:
<script language="VBScript" runat="Server">
Sub Application_OnStart Application("startTime") = Now End Sub