Sharing the Request object in ASP five methods of obtaining client data

Source: Internet
Author: User
Tags servervariables
The ASP's built-in Request object has five methods for obtaining client data (querystring/form/cookies/servervariables/clientcertificate).

Syntax: Request. Method name ("parameter") |request ("parameter")

If the latter is used, the system automatically chooses the appropriate method.

1. Form
Here we re-emphasize some of the properties of the form:

  Enctype= the MIME form of the data transfer     method= the way the data is transmitted Get/post     onrest= Press the rest key to invoke the program onsubmit=     Press the Sumit key to invoke the program     target= frame window for Output content >

There are three ways to send information using form: The form inside the HTML page transmits information to the other ASP, and the information within the ASP is transmitted to the other asp;asp.

Syntax: Request.Form (parameter) [(index)]

Where the parameter represents the name of the element in the form, and the index represents the ordinal number of the same name element.
Cases:
You can iterate over an element named user, where count is the system property of the form that calculates the number of elements of the same name, and if the element does not exist, its value is zero. If you do not indicate that you want to read the element with the same name, the system will read all the values of the element with the same name and use "," as the interval.
Cases:

Request.Form ("user") =ABC,BCD,CDE


2, QueryString

Syntax: request.querystring (parameter) [(index)]

In addition to using the form to transfer data, you can also use the hyperlink after the "?" Transmission of information, such as:, by Request.QueryString ("user") to read the transmitted information, if more than one parameter with duplicate name, such as:, the first time

Resquest.querystring ("user") =abc, second  resquest.querystring ("user") =BCD, third  resquest.querystring ("user") =cde.

3, ServerVariables

Syntax: ServerVariables (parameter name)

We know that the Web/browse transport protocol is the HTTP,HTTP header that will have some client-side information, such as

Client IP address, browser language system, etc. Information can be obtained through Request.ServerVariables ("* * *"), such as Request.ServerVariables ("Accept_language") to obtain the language of the client browser. Other system parameters are shown in the following table:

server_name SERVER.      Server_port server is running the port number Request_method the method that issued the request (Get/post/head script_name the path called by the program, such as: cgi-bin/a.pl.      Remote_host the name of the remote machine (client) on which the request was sent.      REMOTE_ADDR the IP address of the remote machine (client) on which the request was sent.      Remote_ident the name of the user who issued the request (in the case of dial-up internet access), the variable is valid when NCSA IdentityCheck is enabled and the client machine supports RFC 931.      Content_Type the MIME type of the data, for example: "Text/html".      A list of MIME types that the Http_accept client can accept.      The Http_user_agent client sends the request browser type. Http_referer the text URL that the client refers to before reading the CGI program. 

4. Cookies
At the client, the cookie records a lot of information from the client browser, we can get its value through the Request.Cookies ("name") command, or we can record some information on the client by Response.Cookies ("name") = "value" in order to control the visitor. The method for setting up multiple Cookies is Response.Cookies ("name") ("name") = "value".
5. Cache
We can set up a browser to extract information from the cache of pages that have already been visited, as well as similar settings in an ASP program. Where Response.Clear is emptying the client's memory. The Response.buffer=true setting can read data from the cache (false by default).
6, ClientCertificate
ClientCertificate is used to obtain the authentication information for the client browser, which complies with the standard of up to $ A, but the client browser must support the SSL3.0 or PCT1 protocol. This is a two-step process, the first step: the Web server must start the Client authentication option, and the second step is to set it accordingly, so that the method takes effect, otherwise, returns the empty value.

"Recommended"

1. summarize the use instance of the Request object for ASP .

2. share a Request object small case

3. Talk about the use of the two objects: request and response

4. request for an explanation of the ASP system object

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.