ASP six main objects Introduction

Source: Internet
Author: User
Tags format array contains header html form variables variable metabase
Object ASP Six Objects Introduction

One, Application object

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
%>


Second, the ObjectContext object

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.


Third, 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 HasKeys to determine whether a cookie has a sub keyword. The value of HasKeys is true or false.

Request.Form (Parameter) [(Index). Count]

Fill in the collection of all the data in the HTML form. parameter is the name of an element in an HTML form. Use index when a parameter has more than one value (for example, when the multiple property is used in <SELECT>). When a parameter has multiple values, count indicates the number of multiple values.

Request.QueryString (varible) [(Index). Count]

A collection of all values for the query string. Varible is the name of a variable in the query string. When a variable has more than one value, the index is used. When a parameter has multiple values, count indicates the number of values.

Request.servervaribles (Server Environment Variable)

A collection of environment variables. Allow read HTTP headers. You can read any header information by using the HTTP_ prefix. For example, Http_user_agent accepts the client proxy HTTP header (browser type). In addition, you can use the variables shown in the following table to obtain any environmental information.

All_http
All HTTP headers sent by the client, his results are prefixed with HTTP_.

All_raw
All HTTP headers sent by the client have the same result as the client sent, no prefix http_

Appl_md_path
The metabase path of the application.

Appl_physical_path
The physical path corresponding to the application metabase path.

Auth_password
The password that the customer enters in the Password dialog box when using the Basic authentication mode.

Auth_type
This is the authentication method that the server uses to verify the user when they access the protected script.

Auth_User
The user name to authenticate.

Cert_cookie
The unique customer Certificate ID number.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.