Application object is the application-level objects, used in all the sharing of information among users. and the Web application running during lasting maintaining data.
Application attributes :
As follows :
Application object is no built-in attribute, but we can create its own attributes.
“% Application (” Attribute name “)%> = value
Most of Application variables are stored in the Contents pools, When you create a new Application variables, Contents is actually added to the pool one. Below is equivalent to two scripts :
“% Application (” greeting “) =” hello! “%> or “% Application.contents (” greeting “) =” hello! “Application variables exist pool, if it wants all, The methods we have repeatedly use, such as For Each cycle.
<%
For Each item IN Application.Contents
Response.write ( “”> “&item&Applicatio n.Contents (item))
Next
%>
Application methods :
Application of only two ways : one is Lock, Unlock the other. Lock methods which guarantee the same time for only one user of Application operation. Unlock will be used for the abolition of restrictions Lock. Such as :
<%
Application.Lock
Application ( “visitor_num”) =Application ( ” visitor_num “) +1
Application.Unlock
%>
Application events :
1, Application_OnStart ()
When the incident started when the application trigger.
2, Application_OnEnd ()
Application of this incident triggered at the end.
These two events are the essential process definition Global.asp document, connecting data in general definition of the function of these two incidents, then put Global.asp China. For example :
Sub Application_OnStart
Application ( “tt18_ConnectionString”) = “driver={SQL
Server server=jeff;uid=sa;pwd=;database=test ”
End Sub
An array can be defined as Application object, But the array as an object can only be preserved, rather than using the Application (0) removed its value. Can define a temporary array achieve this function. Such as :
<%
Dim Array ()
Array=Application ( “array”)
For i = 0 to ubound (array)
Response.write Array (i)
Next i
%>
Similarly Application to amend the definition of objects can be a temporary array, Application targets assigned to put array, and then the modifications to the array element Finally, given the array to Application Object. Such as :
<%
Dim Array ()
Array=Application ( “array”)
Array (0) = “jeff”
Array (1) = “Dazhu”
Application.lock
Application ( “array”) =Array
Application.unlock
%>

Comment Form

You must be logged in to post a comment.

About this blog

Just for web admin!

Photostream