ASP.NET commonly used built-in object (a) Request

To obtain a client requests a page or Form is transmitted all the information provided. It includes a user variable HTTP, information can be recognized by the browser, Cookie and the client information storing request address.

System.Web.HttpRequest Request object is an object class, automatically created by the system in the page class, it is common properties as follows:

  The QueryString : obtaining a set of HTTP query string variables, primarily used for data collection protocol HTTP Get request is sent

Note:? When behind the address bar add name = wangwu, the server will receive the value of the variable, and then get in the Index method and return

  Form1 : obtaining a collection or form page variable, to request data transmission method of collecting Post

 

  ServerVarible : Environment variables set contains within the server and client system information  https://blog.csdn.net/huwei2003/article/details/84772658

 

  Params : is a collection, which in turn comprises request.querystring, request.form, request.cookies and request.servervariables. First look at QueryString collection of data, if the data is found in the QueryString, it returns the data, if the data is not found and went to find the Form collection, find returns, otherwise sets down to find data.

注:如果直接使用Request["value"]的方式,它会在QueryString、Form、ServerVariable中都按先后顺序搜寻一遍。(优先获取GET方式提交的数据)

 

  Url:获取有关当前请求的URL信息(结合ToString()使用)

 

  UserHostName:获取远程客户端的DNS名称

 

  UserHostAddress:获取远程客户端的IP主机地址

 

  IsLocal:获取一个值,该值指示该请求是否来自本地计算机

 

  Browser:获取或设置有关正在请求的客户端浏览器功能信息

 

常用方法如下:

 

  BinaryRead():执行对当前输入流进行制定字节数的二进制读取

 

  SaveAs():将HTTP请求保存到磁盘

Guess you like

Origin www.cnblogs.com/1016391912pm/p/12131336.html