Asp.net System Object Request (1), asp. netrequest
Request object
It is used to obtain all the information provided by the client when requesting a page or sending a Form.It includes the user's HTTP variables, recognizable browsers, Cookie information of the storage client, and request address.
The Request object is an object of the System. Web. httpRequest class, and its
Common attributes are as follows:
QueryString: a collection of HTTP query string variables. It is mainly used to collect data sent by Get requests in HTTP.
Form: a collection of Form or page variables used to collect request data sent by the Post method.
ServerVarible: The environment variable set contains the system information of the server and client.
Params: it is a set of QueryString, Form, and ServerVarible methods. It does not distinguish the parameter passing method.
Url: Get URL information about the current request
UserHostName: Get the DNS name of the remote client
UserHostAddress: obtains the IP address of the remote client host.
IsLocal: gets a value indicating whether the request comes from a local computer.
Browser: gets or sets information about the client Browser being requested.
The common method is as follows:
BinaryRead (): Binary reads of the specified number of bytes of the current input stream.
SaveAs (): Save the HTTP request to the disk.
Some attributes:
protected void Page_Load(object sender, EventArgs e) { Textbox1.Text = Request.Browser.Browser; Textbox2.Text = Request.Url.ToString(); Textbox3.Text = Request.ContentLength.ToString(); Textbox4.Text = Request.FilePath; Textbox5.Text = Request.HttpMethod; Textbox6.Text = Request.UserHostName; }
Output result:
Conclusion: Request is used to obtain various client information.