ASP Application object
A group of ASP files that work together to perform a task is called an application. The Application object is used to bind these files together.
Application object
An application on the Web can be a group of ASP files. These ASP files work together to perform a task. The Application object is used to bind these files together.
The Application object is used to store and access variables from any page, similar to the Session object. The difference is that all users share one Application object, whereas Session objects have a one-to-one relationship with users.
The Application object holds information that can be used by many pages in an application (such as database connection information). This information can be accessed from any page. You can also change it in one place, and those changes are automatically reflected on all pages.
The collections, methods, and events of the Application object are described below:
Union
| Union | Description |
|---|---|
| Contents | Contains all the items added to the application through script commands. |
| StaticObjects | Contains all the objects added to the application using the HTML |
Method
| Method | Description |
|---|---|
| Contents.Remove | Deletes an item from the Contents collection. |
| Contents.RemoveAll() | Deletes all items from the Contents collection. |
| Lock | Prevents other users from modifying variables in the Application object. |
| Unlock | Allows other users to modify variables in the Application object (after being locked by the Lock method). |
Events
| Events | Description |
|---|---|
| Application_OnEnd | This event occurs when all users' sessions have ended and the application ends. |
| Application_OnStart | This event occurs before the first new session is created (that is, when the Application object is first referenced). |