ASP Application



A group of ASP files that work together to complete a certain task is called an application. The Application object is used to bundle 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 certain task. The Application object is used to bundle these files together.

Application object is used to store and access variables from any page, similar to Session object. The difference is that all users share an Application object, and the relationship between the Session object and the user is one-to-one.

The Application object holds 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 be automatically reflected on all pages.

The collections, methods and events of the Application object are described as follows:

Collection

CollectionDescription
ContentsContains all items appended to the application via script commands.
StaticObjectsContains all objects appended to the application using HTML's <object> tag.

Method

MethodDescription
Contents.RemoveRemove an item from the Contents collection.
Contents.RemoveAll()Remove all items from the Contents collection.
LockPrevent other users from modifying variables in the Application object.
UnlockEnables other users to modify variables in the Application object (after being locked by the Lock method).

Event

EventDescription
Application_OnEndThis event occurs when all user sessions have ended and the application has ended.
Application_OnStartThis event occurs before the first new session is created (that is, when the Application object is referenced for the first time).