Use the Request object

1. Request.AppRelativeCurrentExecutionFilePath , get the current execution of the virtual path request with respect to the application root. Beginning with ~, such as "~ / Handler.ashx".

 

2. Request.PhysicalApplicationPath , to get the physical path of the current application, such as D: \ TEST \ test1 \.

 

3. Request.PhysicalPath , obtaining the physical path of the current request, such as D: \ TEST \ test1 \ test.html .

 

4. Request.RawUrl get the original request URL, URL Request.Url obtaining request, the difference is related to the problem URL rewriting.

 

5 .Request.UrlReferrer source page. According to which the judge from the Baidu search keywords, download anti-hotlinking, anti-hotlinking images, can be forged (such as Thunder). "This picture is offensive XXX internal use" of these is the use of this technology. Global anti-theft chain with Globals.asax.

 

6. Request.UserHostAddress obtain the IP address of the visitor.

 

7. Request.UserLanguage obtain a visitor's browser language support, it can display pages in different languages for people of different languages by this time.

 

8. The Request.Cookies Get browser sent, the browser Cookie. Cookie values read from its inside, such context.Request.Cookies [ "mysessionid"], is generally used only when Request.Cookies read, write Cookie back to the browser to use Response.Cookies.

 

9. The Request.MapPath (the virtualPath) converts the virtual path to physical path on the disk, Request.MapPath ( "~ / a / b.aspx") will give D: \ test \ WebSite \ a \ b.aspx.

Reproduced in: https: //my.oschina.net/u/164404/blog/210650

Guess you like

Origin blog.csdn.net/weixin_33871366/article/details/91982631