现在的位置: 首页 > 综合 > 正文

关于Server.MapPath

2012年03月28日 ⁄ 综合 ⁄ 共 524字 ⁄ 字号 评论关闭
关于Server.MapPath
string Server.MapPath(string path)
返回与Web服务器上的指定虚拟路径相对应的物理文件路径。

<%=Server.MapPath(Request.ServerVariables["PATH_INFO"])%>

<%= Server.MapPath("/")%>
<%= Server.MapPath("")%>
<%=Server.MapPath(".")%>

<%= Server.MapPath("../")%>
<%= Server.MapPath("..")%>  

以上的代码在http://localhost/EnglishClub/manage/WebForm1.aspx页面
运行结果:

C:"Inetpub"wwwroot"EnglishClub"manage"WebForm1.aspx

C:"Inetpub"wwwroot"
C:"Inetpub"wwwroot"EnglishClub"manage
C:"Inetpub"wwwroot"EnglishClub"manage

C:"Inetpub"wwwroot"EnglishClub"
C:"Inetpub"wwwroot"EnglishClub

抱歉!评论已关闭.