ASP的Server.MapPath()不同參數(shù)返回路徑總結(jié)
在使用Server.MapPath()的時候,有很多的參數(shù),什么絕對路徑啊,相對路徑啊,這些不復(fù)雜但是很容易弄混淆的東西,這里將他做一個整理。
./當(dāng)前目錄
/網(wǎng)站主目錄
../上層目錄
~/網(wǎng)站虛擬目錄
如果當(dāng)前的網(wǎng)站目錄為E:\wwwroot
應(yīng)用程序虛擬目錄為E:\wwwroot\company
瀏覽的頁面路徑為E:\wwwroot\company\news\show.asp
在show.asp頁面中使用
Server.MapPath(“./”) 返回路徑為:E:\wwwroot\company\news
Server.MapPath(“/”) 返回路徑為:E:\wwwroot
Server.MapPath(“../”) 返回路徑為:E:\wwwroot\company
Server.MapPath(“~/”) 返回路徑為:E:\wwwroot\company
server.MapPath(request.ServerVariables(“Path_Info”))
Request.ServerVariables(“Path_Translated”)
上面兩種方式返回路徑為 D:\wwwroot\company\news\show.asp
相關(guān)文章
asp下刪除Access數(shù)詞庫中的空記錄的sql語句
asp下刪除Access數(shù)詞庫中的空記錄的sql語句...2007-04-04用ASP實現(xiàn)對ORACLE數(shù)據(jù)庫的操作
用ASP實現(xiàn)對ORACLE數(shù)據(jù)庫的操作...2007-03-03Ajax+ASP和Flash+ASP數(shù)據(jù)讀取取方法有些相似的實現(xiàn)方法
Ajax+ASP和Flash+ASP數(shù)據(jù)讀取取方法有些相似的實現(xiàn)方法...2007-02-02ASP如何檢測某文件夾是否存在,不存在則自動創(chuàng)建
這篇文章主要介紹了ASP如何檢測某文件夾是否存在,不存在則自動創(chuàng)建,需要的朋友可以參考下2020-02-02