ASP Application
A group of ASP files that work together to complete a certain task is called an application.
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 in ASP 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.
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:
Sub Application_OnStart
application("vartime")=""
application("users")=1
End Sub
</script>
In the above example, we created two Application variables: "vartime" and "users".
You can access the value of the Application variable as follows:
<%
Response.Write(Application("users"))
%>
active connections.
Traverse the Contents collection
The Contents collection contains all application variables. You can view the variables stored in the Contents collection by iterating over it:
dim i
For Each i in Application.Contents
Response.Write(i & "<br>")
Next
%>
If you don't know the number of items in the Contents collection, you can use the Count property:
dim i
dim j
j=Application.Contents.Count
For i=1 to j
Response.Write(Application.Contents(i) & "<br>")
Next
%>
##Traverse the StaticObjects collectionYou can view the values of all objects stored in the Application object by iterating through the StaticObjects collection:
For Each i in Application.StaticObjects
Response.Write(i & "<br>")
Next
%>
Lock and Unlock
You can use the "Lock" method to lock an application. When the application is locked, users cannot change the Application variables (except the user who is accessing the Application variables). You can also use the "Unlock" method to unlock the application. This method removes the lock on the Application variable:
Application.Lock
'do some application object operations
Application.Unlock
%>