ASP ApplicationObject
A group of ASP files that work together to accomplish 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 set of ASP files. These ASP files work together to accomplish 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, while the relationship between Session objects and users is one-to-one.
The Application object stores information that will be used by many pages in the application (such as database connection information). This information can be accessed from any page. You can also change this information in one place, and the changes will automatically be reflected on all pages.
The Application object's collections, methods, and events are described as follows:
Collection
| Collection | Description |
|---|---|
| Contents | Contains all items appended to the application through script commands. |
| StaticObjects | Contains all objects appended to the application using the HTML <object> tag. |
Methods
| Method | Description |
|---|---|
| Contents.Remove | Removes an item from the Contents collection. |
| Contents.RemoveAll() | Removes 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
| Event | 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). |
Other Extensions