The ASP. NET Request object function is used to obtain data from the client. Three common methods for obtaining data are Request. Form, Request. QueryString, and Request. The third is an abbreviation of the first two cases, which can replace the first two cases. The first two methods correspond to two different submission methods for Form submission: Post method and Get method.
ASP.. NET Request object has many attributes and Methods. Several commonly used methods are: UserAgent returns the version information of the client browser, and UserHostAddress returns the Host IP address of the remote client machine, userHostName returns the DNS name of the remote client machine, and PhysicalApplicationPath returns the real path of the current request webpage on the Server.
Use an ASP. NET Request object to obtain data from a browser
The ASP. NET Request object method can be used to read the data submitted by other pages. The submitted data can be submitted in two forms: one is submitted through the Form, the other is submitted through the parameters after the hyperlink, and the two methods can be read using the Request object.
- <%@ Page Language ="C #"%>
-
- <%
- StringStrUserName = Request ["Name"];
-
- StringStrUserLove = Request ["Love"];
-
- %>
- Name: <%= strUserName %>
-
- Hobbies: <%= strUserLove %>
-
- <Form action =""Method ="Post">
-
- <P> name: <input type ="TEXT"Size ="20"Name ="Name"></ P>
-
- <P> interest: <input type ="TEXT"Size ="20"Name ="Love"></ P>
-
- <P> <input type ="Submit"Value ="Submit"></ P>
-
- </Form>
Use the ASP. NET Request object to obtain client information.
Using the built-in properties of the Request object, you can obtain some client information, such as the client browser version and client address.
- <%@ Page Language ="C #"%>
-
- Client browser: <%= Request. UserAgent %>
-
- Client IP Address: <%= Request. UserHostAddress %>
-
- Physical path of the current file server: <%= Request. PhysicalApplicationPath %>
The usage of ASP. NET Request objects is introduced here, and it is helpful for you to understand ASP. NET Request objects.
- ASP. NET control usage tips
- Analysis of ASP. NET annotations
- Analysis on the use of ASP. NET trace
- Application of ASP. NET trace in page execution
- Introduction to ASP. NET Request Object Attributes