ASP six major objects introduction one, Application object
The Application object is an application-level object to share information between all users, and can maintain data during the Web application running. Application's Properties: The method is as follows: Application object does not have built-in properties, but we can create its properties yourself. <% Application ("Attribute Name) = Value%> In fact, most Application variables are stored in the Contents collection, when you create a new Application variable, actually adding an item in the Contents collection. The following two scripts are equivalent: <% Application ("Greeting") = "Hello!"%> Or <% Application.contents ("Greeting") = "Hello!" Because the Application Variable is in the collection, if you want To display all, however, we have used multiple times, such as for Each loops. <% For each itemin application.contents response.write ("
") Next%> Application method: Application method only two methods: one is LOCK, the other is Unlock. Where the LOCK method is used to ensure that only one user can operate on the Application. UNLOCK is used to cancel the limit of the LOCK method. Such as: <% Application.lockApplication ("Visitor_Num") = Application ("Visitor_Num") 1Application.unlock%> Application's event: 1, Application_onstart () triggered when the event application starts. 2, Application_ONEND () This event application triggered. These two events must be defined in the global.asp file, generally defining the function of the connection data in both events and placed in Global.asp. For example: Sub Application_onstart Application ("TT18_Connectionstring") = "driver = {SQL Server}; server = jeff; UID = SA; PWD =; Database = TEST" End Sub A array can be defined as Application object, but this array can only Save as an object without using Application (0) to remove its value. You can define a temporary array implementation. Such as: <% DIM array () array = application ("array" for i = 0 to ubound (array) response.write array (i) Next I%> To modify this Application object, you can also define a temporary array, The Application object assigns an array and then modifies the elements of this array, and finally assign an array to the Application object.
Such as: <% DIM array () array = Application ("array") array (0) = "jeff" array (1) = "zhu" Application.lockApplication ("array") = arrayapplication.unlock%> Second, ObjectContext object This object is used to control the transaction processing of Active Server Pages. The Office is managed by Microsoft Transaction Server (MTS).
event
ObjectContext.ontransactionAbort
The abandoned transaction process is excited, and after the script is completed.
ObjectContext.ontransactionCommit
The successful transaction event is excited, and after the script is completed, it occurs.
method
ObjectContext.Setabort
Explicitly abandoned a transaction.
ObjectContext.setComplete
Overwrite any call to call the ObjectContext.Setabort method. Third, the Request object Request object is used to accept all information from the request from the browser to your server.
set
Request.ClientCertificate (key [subfield])
Collection of information for all customer certificates. For Key, the collection has the following keywords:
The subject of the Subject certificate. Contains all information about certificate receipts. Can be used with all subdomain suffixes.
Issuer certificate issuer. Contains all information about certification verification. In addition to CN, it can be used with all subdomain suffixations.
VadidFrom certificate issued date. Use the VBScript format.
Validuntil This certificate is not valid.
SerialNumber contains the serial number of the certificate.
Certificate contains binary streams of the entire certificate, using the ASN.1 format.
For Subfield, Subject, and Issuer keywords can have the following subdomain suffix: (such as: Subjectou or Issuerl)
C originated in the country.
O Company or organization name.
OU organizational unit.
CN user's routine name.
L Local.
S state (or province).
Tone or company title.
GN given name.
I is initially.
When the file cervbs.inc (VBScript) or CERJAVAS.INC (JScript) is included in your Active Server Page by using a #include orientation, the following two signs can be used:
CECERTPRESENT indicates whether the customer certificate exists, its value is true or false.
CEUNRECONGNIZEDISSURE indicates whether the issuer of the last certificate in the chain is unknown, its value is True or FALSE.
Request.cookies (cookie [(key) .attribute])
Collection of cookies. Allow the browser's cookie. Cookie indicates that returns that cookie. KEY is used to return a cookie value with a keyword from the Cookie dictionary. For Attribute, you can use attribute Haskeys to determine if a cookie has a child keyword. The value of Haskeys is TRUE or FALSE.
Request.form (Parameter) [(index) .count]
Fill in the collection of all data in the form of HTML. Parameter is the name of a certain element in the HTML form. When a parameter has more than one value (for example, when using a multiple attribute in
Request.QueryString (varible) [(index) .count] Querys the collection of all values of the string. Varible is the name of a variable in the query string. When a variable has more than one value, INDEX is used. When a parameter has a number of values, count refers to the number of values.
Request.ServerVaribles (Server Environment Variable)
A collection of environment variables. Allow reading HTTP headers. You can read any header information by using an HTTP_ prefix. For example, http_user_agent accepts a client agent HTTP header (browser type). In addition, you can use any environmental information using the variables shown in the table below.
All HTTP headers sent by the all_http client, his results have prefix http_.
All HTTP headers sent by the all_raw client, the result is when the client sends, no prefix http_
The metadata path for Appl_md_path applications.
Appl_physical_path The physical path corresponding to the application element database path.
Auth_password When using basic authentication mode, the password entered in the Password dialog box.
Auth_type This is the server for verifying the user's verification method when the user has access protected script.
Auth_user's verification username.
CERT_COOKIE unique customer certificate ID number.
Cert_flag Customer Certificate Sign, if there is a client certificate, bit0 is 0. If the client certificate verification is invalid, Bit1 is set to 1.
The entrant field in the Cert_issuer user certificate.
The Cert_Keysize Secure Socket Tag layer The number of bits of the keyword, such as 128.
The Cert_secretKeysize server verifies the number of bits of the private key. Such as 1024.
The sequence number field of the Cert_SerialNumber customer certificate.
The entrant field of the Cert_Server_issuer Server Certificate
The Cert_Server_Subject The topic field of the server certificate.
The subject field of the Cert_Subject client certificate.
The Content_length client issues the length of content.
Content_type The form of FORM content or HTTP PUT sent by the client.
Gateway_Interface server uses the gateway interface.
HTTPS returns ON if requests through the Secure Channel (SSL). Returns OFF if requests from non-secure channels.
HTTPS_KEYSIZE Secure Sockets The number of bits of the keyword is connected, such as 128.
The HTTPS_SecretKeysize server verifies the number of bits of the private key. Such as 1024.
HTTPS_SERVER_ISUER The issuer field of the server certificate.
HTTPS_SERVER_SUBJECT The subject field of the server certificate.
INSTANCE_IDIIS Id number of the Id number.
Instance_meta_path responds to the metabological path of the requested IIS instance.
Local_addr Returns the server address that accepts the request.
Logon_User user logs in to Windows NT account
Path_INFO client provides path information.
Path_Translated paths obtained after the virtual to physical mapping.
Query_string query string content.
Remote_addr issues the IP address of the requesting remote host.
Remote_host issues a request for remote host name.
Request_method proposes a method of request. For example, Get, Head, POST, etc.
Script_name executes the name of the script.
The host name, DNS address, or IP address of the Server_Name server.
Server_Port accepts the requested server port number.
Server_Port_Secure is 1 if the request-received server port is the security port, otherwise 0.
The name and version of the protocol used by the Server_Protocol server.
Server_software answers the name and version of the server software for the request and run the gateway.
The URL provides the basic part of the URL.
method
Request.binaryRead (count)
Receive an unprocessed content of an HTML form. When this method is called, count indicates how many bytes to receive. After calling this method, count indicates how many bytes do actually receive.
Attributes
Request.totalbytes
The length of the query body, in bytes, RESPONSE objects
The Response object is used to send data to the client browser. The user can use the object to send the server's data to the user-end browser in HTML, which forms a pair of receptions, transmitted data, which is implemented with the request. Foundation. The following describes the properties and methods of it.
1. Buffer attribute This property is used to specify whether the page output is used to use the buffer, the default value is false. When it is True, the result is output to the browser until the entire Active Server Page executes. Such as: <% response.buffer = true%>
2, Expires property This property is used to set the length of time (in points) of the browser cache page, and must be refreshed on the server. By setting: <% response.expires = 0%> By adding this line of code in the ASP file, requesting each request is a refresh page, because Response will expire.
3. Write method This method sends data to the client browser, such as: <% response.write "Hello, World!"%>
4. Redirect method This method allows the browser to reposition to another URL, so that when the customer issues a web request, the client's browser type has been determined, and the customer is relocated to the corresponding page. Such as: