Multiple paths in ASP. NET
Request Information
Request. AppRelativeCurrentExecutionFilePath ~ /SysOption/BillingSetup1.aspx
Request. ApplicationPath/
Request. CurrentExecutionFilePath/SysOption/BillingSetup1.aspx
Request. FilePath/SysOption/BillingSetup1.aspx
Request. Path/SysOption/BillingSetup1.aspx
Request. PathInfo has no other usage to be tested)
Request. PhysicalApplicationPath D: \ VssWorkFolder \ briish_school_mis \ src \ WebSite \
Request. PhysicalPath D: \ VssWorkFolder \ briish_school_mis \ src \ WebSite \ SysOption \ BillingSetup1.aspx
Request. UserHostAddress 192.168.1.6
Request. UserHostName 192.168.1.6
Request. Url. ToString () http: // 192.168.1.6/SysOption/BillingSetup1.aspx? X = d
Request. UrlReferrer: Empty reference or jump to the Source Page address
Related information obtained from the Request. ServerVariables collection:
The left column is the server variable name, the right column is the value, and the value is obtained through Request. ServerVariables [server variable name ].
- APPL_MD_PATH : /LM/W3SVC/894523/Root
- APPL_PHYSICAL_PATH : D:\VssWorkFolder\British_School_MIS\src\WebSite\
- INSTANCE_META_PATH : /LM/W3SVC/894523
- LOCAL_ADDR : 192.168.1.6
- PATH_INFO : /SysOption/BillingSetup1.aspx
- PATH_TRANSLATED : D:\VssWorkFolder\British_School_MIS\src\WebSite\SysOption\BillingSetup1.aspx
- REMOTE_ADDR : 192.168.1.6
- REMOTE_HOST : 192.168.1.6
- SCRIPT_NAME : /SysOption/BillingSetup1.aspx
- SERVER_NAME : 192.168.1.6
- URL : /SysOption/BillingSetup1.aspx
Request. ServerVariables is a powerful tool that can help us get a lot of client and web host information. If you are interested, you can use the following code to see what information it contains.
- foreach (string s in Request.ServerVariables)
- {
- Response.Write(s + " : " + Request.ServerVariables[s] + "
-
-
- }
Path conversion in ASP. NET
1. convert to the Server path Server. MapPath)
An interesting question about web server development and design is address translation. For example, http address/images/a.txt. If you want to read the file through io on the server side, you must have the local address of the file "c: \ windows \ system32 \ xx. dll) ", then Server. mapPath is useful.
Response. Write (Request. MapPath (Request. Path); output: D: \ VssWorkFolder \ briish_school_mis \ src \ WebSite \ SysOption \ BillingSetup1.aspx
2. Convert to http address Page. ResolveClientUrl Page. ResolveUrl)
Response. Write (Page. ResolveClientUrl ("~ /A/a.jpg "). The output is ../a/a.jpg.
Response. Write (Page. ResolveUrl ("~ /A/a.jpg "). The output is/a/a.jpg.
Here is a detailed description of various paths in ASP. NET.
This article is from zyip's blog post "n paths in asp.net"
- Implementation of ASP. NET report printing: Paging Calculation Method
- ASP. NET DataGrid custom paging source code
- Implementation of ASP. NET paging code (C #, FCKeditor)
- Overview of ASP. NET basic syntax
- ASP. NET Installation Steps