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
返回与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
解决方案 »
- DropDownList 宽度设置奇怪的现象,在线等,谢谢!
- 正则表达式问题,
- TreeView树形结构的使用
- 请问我想知道我页面上的搜狗广告链接每天被点击了多少次,用.net可以实现吗?
- 属性未被识别为“minRequiredNonAlphanumericCharacters”
- 怎样实现对一个daset进行根据条件进行再次查询,然后把再次查询得到的结果集传到别一个dataset中?
- 帮忙啊!大家!
- asp.net无法调试,高手请进
- asp.net下,我要单击LinkButton后,转到另外一个网页,在LinkButton_Click事件中,
- 关于ASP.NET网页编程中校验控件出错处理的问题
- 类型“TextBox”的控件“TextBoxxm”必须放在具有 runat=server 的窗体标记内。这个问题怎么解决?
- cookie乱码
2.Server.MapPath("./") 表示所在页面的当前目录
注:等价于Server.MapPath("") 返回 Server.MapPath("")所在页面的物理文件路径
3.Server.MapPath("../")表示上一级目录
4.Server.MapPath("~/")表示当前应用级程序的目录,如果是根目录,就是根目录,如果是虚拟目录,就是虚拟目录所在的位置如:C:\Inetpub\wwwroot\Example\
注:等效于Server.MapPath("~")。