Home >Backend Development >C#.Net Tutorial >Detailed explanation of ASP.NET system object Request

Detailed explanation of ASP.NET system object Request

零下一度
零下一度Original
2017-05-23 11:49:023032browse

Request object

 Used toobtain all the information provided by the clientwhen requesting a page or transmitting a Form . It includes the user's HTTP variables, identifiable browsers, cookie information and request addresses stored on the client, etc.

The Request object is an object of the System.Web.httpRequest class. Its

common properties are as follows:

QueryString: Gets the set of HTTP query string variables, mainly used to collect the data sent by Get request in the HTTP protocol

Form: Gets the set of form or page variables, use Used to collect the request data sent by the Post method

ServerVarible: The environment variable collection contains the system information of the server and client

Params: It is A collection of three methods: QueryString, Form and ServerVarible, regardless of which method the parameters are passed

Url: Get URL information about the current request

UserHostName: Get the DNS name of the remote client

UserHostAddress: Get the IP host address of the remote client

IsLocal: Get a Value indicating whether the request is coming from the local computer

Browser: Gets or sets information about the client browser capabilities being requested

Commonly used methods are as follows:

BinaryRead(): Execute binary reading of a specified number of bytes on the current input stream

SaveAs(): Save HTTP request to disk

Partial properties:

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:

Summary: Request is used to obtain various information from the client

[Related recommendations]

1. Summary of Asp.net built-in object Request object usage examples

2. Share a small case of Request object

3. Share the five methods of obtaining client data in the request object in asp

4. Talk about the two Request and Response Use of objects

The above is the detailed content of Detailed explanation of ASP.NET system object Request. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn