ASP. NET Request object

Source: Internet
Author: User

The request object function is used to obtain data from the client. The three methods commonly used to obtain 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.
There are many properties and methods for the request object. Several Common examples 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.

Obtain data from a browser 
The request 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 #" %>
<%
String strusername = request ["name"];
String struserlove = 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>

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 %>

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.