中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

ASP MapPath 方法


Server 對象參考手冊 完整的 Server 對象參考手冊

MapPath 方法可把指定的路徑映射到服務(wù)器上相應(yīng)的物理路徑上。

注意:此方法不能用于 Session.OnEnd 和 Application.OnEnd 中。

語法

Server.MapPath(path)
參數(shù) 描述
path 必需。映射為物理路徑的相對路徑或絕對路徑。如果該參數(shù)以 / 或 開頭,則返回完整的虛擬路徑。如果該參數(shù)不以 / 或 開頭,則返回相對于正在被處理的 .asp 文件的路徑。

實例

實例 1

舉例,文件 test.asp 位于 C:InetpubwwwrootScript。

文件 Test.asp (位于 C:InetpubwwwrootScript) 包含下列代碼:

<%
response.write(Server.MapPath("test.html") & "<br>")
response.write(Server.MapPath("script/test.html") & "<br>")
response.write(Server.MapPath("/script/test.html") & "<br>")
response.write(Server.MapPath("script") & "<br>")
response.write(Server.MapPath("/") & "<br>")
response.write(Server.MapPath("") & "<br>")
%>

輸出:

c:inetpubwwwrootscripttest.html
c:inetpubwwwrootscriptscripttest.html
c:inetpubwwwrootscripttest.html
c:inetpubwwwrootscript
c:inetpubwwwroot
c:inetpubwwwroot

實例 2

如何使用一個相對路徑來返回到達正在瀏覽器中查看的頁面的相對物理路徑:

<%
response.write(Server.MapPath("../"))
%>

或者:

<%
response.write(Server.MapPath(".."))
%>

Server 對象參考手冊 完整的 Server 對象參考手冊其他擴展