Product Home Page | Developer Site | Version | |
ASP Application object events are listed in the following table.
Values can be stored in the Application object. These values are available throughout the application and have application scope.
Objects can be created within the Application_OnStart script and assigned to the Application object. You cannot, however, store a built-in object in the Application object. Each of the following lines will return an error:
Set Application("var1") = Session
Set Application("var2") = Request
Set Application("var3") = Response
Set Application("var4") = Server
Set Application("var5") = Application
Before you store an object in the Application object, you must know what threading model it uses. Only objects marked as both free and apartment-threaded can be stored in the Application object.
The Application object is implemented as a collection. If you store an array in an Application object, you should not attempt to alter elements of the stored array directly. For example, the following script does not work:
Application("StoredArray") (3) = "new value"
Instead of storing the value "new value
" in StoredArray(3)
the value is stored in the Application collection, overwriting any information stored at Application(3)
.
Note | If you store an array in the Application object, it is strongly recommended that you retrieve a copy of the array before retrieving or changing any elements of the array. When you are done making changes to the array, store the array back into the Application object to save changes. This is demonstrated in the following examples. |
Copyright © 2003 Sun Microsystems, Inc. All rights reserved.