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