Request objects include:
Header
Basic information about the client (such as the browser type, version number, user language, and encoding method)
Request Method (Post or Get)
Parameter Name
Parameter Value
Call method of the Request object:
Request. Collection ["Variable"]
Collection includes QueryString, Form, Cookies, and ServerVariables. Collection can be omitted. For example, you can use Request ["Variable"] to call the Collection, but this will reduce the efficiency.
The following are four sets:
QueryString set
The information collected by the QueryString collection is from "?" In the request Url. The data following the "Url Additional Information ":
Http://www.aspcn.com/show.asp? Id = 111
In this Url, the information collected by QueryString is "Show. asp ?" Additional data "id = 111 ".
In this case, the statement for obtaining the parameter value of the parameter id is:
Request. QueryString ["id"]
The QueryString collection is mainly used to collect the data sent by Get requests in the Http protocol. If "?" appears in the Requested program Url in a request event, Indicates that the request method is Get. The most common hyperlink is to send requests through Get. You can also send Get requests through Form, such:
On the show. asp page, you can use Request. QueryString ["id"] to obtain the parameter value of id.
Form set
The Form set is similar to QueryString, but it is used to collect the request data sent by the Post method (the Get method can only transmit 256 bytes of data, and the Post can reach 2 MB ).
Post requests must be sent by Form. For example:
On the show. asp page, you can use Request. Form ["id"] to obtain the parameter value of id.
Cookie set
ServerVariable set
The ServerVariable (environment variable) set contains the system information of the server and client.
--- Client:
(1) obtain the client browser version: Request. ServerVariable ["HTTP_USER_AGENT"]
(2) obtain the Client IP Address: Request. ServerVariable ["REMOTE_ADDR"]
(3) obtain the language used by the Client: HTTP_ACCEPT_LANGUAGE
(4) Request Retrieval Method: REQUEST_METHOD
(5) Total number of characters for retrieving request information: CONTENT_LENGTH
(6) CONTENT_TYPE
(7) obtain additional URL Information: QUERY_STRING
(8) obtain the Gateway Interface: GATEWAY_INTERFACE
--- Server:
(1) obtain the Server IP Address: Request. ServerVariable ["LOCAL_ADDR"]
(2) obtain the server host name: Request. ServerVariable ["SERVER_NAME"]
(3) obtain the virtual directory of the current execution program: PATH_INFO
(4) obtain the absolute path of the current execution program: PATH_TRANSLATED
(5) Get the file name of the current program (including the Virtual Path): SCRIPT_NAME
(6) obtain the server's port for receiving the request: SERVER_PORT
(7) obtain the server-compliant protocol and version: SERVER_PROTOCAL
Browser object
The Browser object of ASP.net is obtained directly by calling the Browser attribute of the Request, which can obtain more in-depth information about the Browser.
Check the browser type: Request. Brower. Brower display result, such as IE
Check the browser Version: the result of Requet. Brower. Version is displayed, for example, 6.0b.
Check whether the browser supports ActiveX Control: ActiveXControls
Checks whether the browser supports Cookies: Cookies
Check whether the browser supports VBScript: VBSCript
Other Request attributes and methods:
* FilePath: obtains the file path of the current Request, for example, String filePath = Request. FilePath;
* HttpMethod: method used to obtain the current request
* Files
* Params obtains the QueryString + Form + ServerVariable + Cookies set.
* Size of the TotalBytes request content
* Url information, for example:
HttpUrl objUrl = Request. URL;
String sPort = objUrl. Port;
String sProtocol = objUrl. Protocol;
* UserHostAddress (user IP address), UserHostName, and userages