Analysis on the use of ASP. NET Request objects

Source: Internet
Author: User

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.

 
 
  1. <%@ Page Language ="C #"%>
  2.  
  3. <%
  4. StringStrUserName = Request ["Name"];
  5.  
  6. StringStrUserLove = Request ["Love"];
  7.  
  8. %>
  9. Name: <%= strUserName %>
  10.  
  11. Hobbies: <%= strUserLove %>
  12.  
  13. <Form action =""Method ="Post">
  14.  
  15. <P> name: <input type ="TEXT"Size ="20"Name ="Name"></ P>
  16.  
  17. <P> interest: <input type ="TEXT"Size ="20"Name ="Love"></ P>
  18.  
  19. <P> <input type ="Submit"Value ="Submit"></ P>
  20.  
  21. </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.

 
 
  1. <%@ Page Language ="C #"%>
  2.  
  3. Client browser: <%= Request. UserAgent %>
  4.  
  5. Client IP Address: <%= Request. UserHostAddress %>
  6.  
  7. 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.

  1. ASP. NET control usage tips
  2. Analysis of ASP. NET annotations
  3. Analysis on the use of ASP. NET trace
  4. Application of ASP. NET trace in page execution
  5. Introduction to ASP. NET Request Object Attributes

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.