![]() |
||||||||
|
[Lifetime of variables][Applications][The
Global.asa file][ASP Built-in Objects][Response
Object] The Application Object is used to tie together Web pages into an application. The Application Object stores variables and objects for the entire application. Any page that is a part of this application can access these variables and objects. There is one instance of the Application Object for each application running on the server, but many clients can access the same application. Store and Retrieve Variables' Values Application variables and objects must be created in the Global.asa file, but they can be accessed and changed by any page in the application. You can store variables in the Application Object (in global.asa), like this:
You can get variable values from the Application Object, like this:
Looping Through the Contents You can loop through the "Contents" collection, to see the values of all the variables stored in the Application Object:
Result:
If you don't know how many items are stored in a "Contents" collection, you can use the "Count" property:
Result:
Looping Through the Objects You can loop through the "StaticObjects" collection, to see the values of all the objects stored in the Application Object:
Lock and Unlock You can lock an application with the "Lock" method. When an application is locked, the users can not change the Application variables (other than the one currently accessing it). You can unlock an application with the "Unlock" method. This method removes the lock from the Application variable:
|
||||||||
![]() |
||||||||