ASP still follows the popular method of using the form on the client for data exchange. The ASP built-in request object has five methods to obtain client data (querystring/form/cookies/servervariables/clientcertificate ).
Syntax: request. Method Name ("parameter") | request ("parameter ")
If the latter is used, the system automatically selects the corresponding method.
Form
Here we re-emphasize some attributes of form:
Enctype = mime form of Data Transmission
Method = method of data transmission get/post
Onrest = call by pressing the rest keyProgram
Onsubmit = press the sumit key to call the program
Target = frame window of the output content>
There are three methods to transmit information by using form: transmitting information from form on the HTML webpage to other ASP; transmitting information from form in ASP to another ASP; information in ASP is transmitted to itself.
Syntax: request. Form (parameter) [(INDEX)]
The parameter indicates the name of the element in form, and the index indicates the sequence number of the element with the same name.
Example:
Users can be read cyclically. Count is the system attribute of form and is used to calculate the number of elements with the same name. If the element does not exist, the value is zero. If it does not specify the number of elements with the same name to be read, the system reads the values of all elements with the same name and uses "," as the interval.
Example: request. Form ("user") = ABC, BCD, CDE
2. querystring
Syntax: request. querystring (parameter) [(INDEX)]
In addition to using form to transmit data, you can also connect "?" You can use request. querystring ("user") to read the transmitted information. If multiple parameters with the same name appear, for example
Resquest. querystring ("user") = ABC, second time
Resquest. querystring ("user") = BCD, third time
Resquest. querystring ("user") = CDE.
3. servervariables
Syntax: servervariables (parameter name)
We know that the Web/browse transmission protocol is HTTP, And the HTTP header has some client information, such
Customer IP address, browser language system, etc. In this case, you can obtain relevant information through request. servervariables ("***"), such as request. servervariables ("accept_language"), to obtain the language family of the client browser. Other system parameters are shown in the following table:
The name or IP address of the server.
Server_port server is running port number
Request_method: Method for sending a request (get/post/head
The path to which the script_name program is called, for example, cgi-bin/a. pl.
The name of the remote machine (client) That remote_host sends the request.
The IP address of the remote machine (client) That remote_addr sends the request.
The name of the user whose remote_ident sends the request (if it is a dial-up Internet access, it is the user ID). This variable is valid when NCSA identitycheck is enabled and the client machine supports RFC 931.
Mime Type of content_type data, for example, "text/html ".
List of MIME types acceptable to http_accept client.
The type of browser in which http_user_agent client sends a request.
Http_referer refers to the text URL of the client before reading the CGI program. (I tested it. It is case-sensitive. Browsers are case-insensitive)
4. Cookies
On the client side, cookies record a lot of information about the client browser. the cookie ("name") command can also be used to obtain its value through response. cookies ("name") = "value" records some information on the client to control visitors. The method for setting multiple cookies is response. Cookies ("name") ("name") = "value ".
5. Cache
We can select the page information that has been accessed from the cache in the browser. Similarly, we can perform similar settings in the ASP program. Response. Clear indicates clearing the client memory. Response. Buffer = true set to read data from the cache (false by default ).
6. clientcertificate
Clientcertificate is used to obtain the Identity confirmation information of the client browser (which complies with the X.509 standard), but the client browser must support SSL3.0 or pct1 protocol. Here we need to do two steps. Step 1: The Web server must start the client authentication option; Step 2: Set the client browser so that this method will take effect. Otherwise, returns the empty value.