Objects | tips
Application Objects
The Application object is an application-level object that is used to share information among all users and to persist data over time while the Web application is running.
Properties of application:
The method is as follows:
The Application object has no built-in properties, but we can create its own properties.
<% Application ("property name") = value%>
In fact, most application variables are stored in the Contents collection, and when you create a new application variable, you actually add an item to the Contents collection. The following two scripts are equivalent:
<% Application ("greeting") = "hello!"%> or <% application.contents ("greeting") = "hello!" Because the application variable exists in the collection, if you want to show it all, the method we have used many times, such as for Each loop.
<%
For each item in Application.Contents
Response.Write ("<br>" &item&application.contents (item))
Next
%>
The Application Method:
There are only two methods for application: One is lock and the other is unlock. Where the lock method is used to ensure that only one user can operate on the application at the same time. Unlock is used to cancel the lock method limit. Such as:
<%
Application.Lock
Application ("Visitor_num") =application ("Visitor_num") +1
Application.UnLock
%>
Application events:
1, Application_OnStart ()
triggered when an event application is started.
2, Application_OnEnd ()
Triggered at the end of this event application.
Both of these event procedures must be defined in the global.asp file, typically defining the function of the connection data in both events and then placing them in the global.asp. For example:
Sub Application_OnStart
Application ("tt18_connectionstring") = "Driver={sql
server};server=jeff;uid=sa;pwd=;d Atabase=test "
End Sub
An array can be defined as a Application object, but the array can only be saved as an object and not application (0) to fetch its value. You can define a temporary array to implement this functionality. Such as:
<%
Dim Array ()
Array=application ("array")
For i = 0 To UBound (array)
Response.Write Array (i)
Next I
%>
You can also modify the Application object to define a temporary array, assign the application object to the array, modify the elements of the array, and finally assign the array back to the Application object. Such as:
<%
Dim Array ()
Array=application ("array")
Array (0) = "Jeff"
Array (1) = "Zhu"
Application.Lock
Application ("array") =array
Application.UnLock
%>
ObjectContext Objects
This object is used to control transaction processing for active Server pages. Transaction processing is managed by Microsoft Transaction Server (MTS).
Event
Objectcontext.ontransactionabort
Fired by a discarded transaction event, which occurs after the script finishes processing.
Objectcontext.ontransactioncommit
Fired by a successful transaction event, which occurs after the script finishes processing.
Method
ObjectContext.SetAbort
Explicitly discards one transaction at a time.
ObjectContext.SetComplete
Overrides any previous call to invoke the ObjectContext.SetAbort method.
Request Object
The request object is used to accept all information from the browser sent to your server.
Collection
Request.clientcertificate (Key[subfield])
A collection of information about all customer certificates. For key, the collection has the following keywords:
Subject
The subject of the certificate. Contains all information about the certificate receipt. Can be used in conjunction with all child domain suffixes.
Issuer
The issuer of the certificate. Contains all information about certificate validation. In addition to CN, can be used with all child domain suffixes.
Vadidfrom
Date the certificate was issued. Use VBScript format.
Validuntil
The certificate is not in a valid time.
SerialNumber
Contains the serial number of the certificate.
Certificate
A binary stream that contains the entire contents of the certificate, using the ASN.1 format.
For subfield,subject and Issuer keywords, you can have the following subdomain suffixes: (for example, Subjectou or Issuerl)
C
Country of origin.
O
The name of the company or organization.
OUs
Organizational unit.
CN
The general name of the user.
L
Local.
S
State (or province).
T
The title of the individual or company.
Gn
The given name.
I
Initial.
When file Cervbs.inc (VBScript) or Cerjavas.inc (JScript uses) is included in your active Server page by using the #include guide, the following two flags can be used:
Cecertpresent
Indicates whether the client certificate exists with a value of true or false.
Ceunrecongnizedissure
Indicates whether the publisher of the last certificate in the list is unknown, and its value is true or false.
Request.Cookies (cookie[(key). Attribute])
A collection of cookies. Allows you to obtain a cookie from your browser. The cookie indicates that a cookie is returned. Key is used to return a cookie value with a keyword from the cookie dictionary. For attributes, you can use attribute Haskey