ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath的区别...
1.Request.ApplicationPath->當前應用的目錄?
? Jsp中, ApplicationPath指的是當前的application(應用程序)的目錄,ASP.NET中也是這個意思。?
? 對應的--例如我的服務器上有兩個web應用域名都是yoursite.com 一個映射到目錄yourdir01/1/ 另一個影射到 yourdir02/2/?
? 那么yourdir01/1/就是第一個應用的ApplicationPath 同理 yourdir02/2/就是第二個應用的ApplicationPath
2.Request.FilePath->對應于iis的虛擬目錄?
? 如 URL http://yoursite.com/1/index.html/pathinfo?
? FilePath = /1/index.html
3.Request.Path->當前請求的虛擬路徑?
? Path 是 FilePath 和 PathInfo 尾部的串聯。例如 URL http://yoursite.com/1/index.html/pathinfo?
? 那么Path = /1/index.html/pathinfo
4.Request.MapPath(string url)->將url映射為iis上的虛擬目錄?
? 這個目錄都是相對于application的根目錄的?
? 于Server.MapPath相比,不會包含類似c:/這樣的路徑?
? 可以理解為是相對路徑(對比的Server.MapPath就是絕對路徑)
5.Server.MapPath(string url)->將url映射為服務器上的物理路徑?
? 例如 http://yoursite.com/1/index.html? 假設你的應用程序在c:/iis/MySite中?
? 那么就是 c:/iis/MySite/1/index.html
總結
以上是生活随笔為你收集整理的ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath的区别...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle使用Shell脚本导出Exc
- 下一篇: android wp主题,WP桌面:wi