Application Variables

Overview

You can use the built-in Application object to store developer-defined global application information that is persistent for the life of the application.

Code Tour

This example demonstrates this storage ability by implementing a simple counter. The total number of times that client browsers visit the sample script is stored in the application variable AppPageCount, and incremented each time the script is accessed.

Note   Because the Application object for a given application is available to many client browsers simultaneously, the object must be locked before a property or value is changed, and unlocked after the change. Locking is not necessary if the value or property is simply being queried.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\applications\Application_VBScript.asp and ...\asp\applications\Application_JScript.asp.