Easy Tutorial
❮ Asp Contentrotator Met Mappath ❯

ASP Application Object


A set of ASP files working together to accomplish a task is referred to as an application.


Application Object

An application on the web can be a set of ASP files. These ASP files work together to complete a task. The Application object in ASP is used to bundle 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 the Session object is unique to each user.

The Application object holds information that many pages in the application use (such as database connection information). This information can be accessed from any page. Changes made in one place are automatically reflected on all pages.


Storing and Retrieving Application Variables

Application variables can be accessed and changed by any page in the application.

You can create Application variables in "Global.asa" as follows:

In the above example, we created two Application variables: "vartime" and "users".

You can access the value of Application variables as follows:


Iterating Through the Contents Collection

The Contents collection contains all application variables. You can iterate through the Contents collection to view the stored variables:

If you are unsure of the number of items in the Contents collection, you can use the Count property:


Iterating Through the StaticObjects Collection

You can iterate through the StaticObjects collection to view all objects stored in the Application object:


Locking and Unlocking

You can use the "Lock" method to lock the application. When the application is locked, users cannot change Application variables (except for the user currently accessing the Application variables). You can also use the "Unlock" method to unlock the application. This method removes the lock on the Application variables:

❮ Asp Contentrotator Met Mappath ❯