string Server.MapPath(string path)
返回与Web服务器上的指定虚拟路径相对应的物理文件路径。

<%=Server.MapPath(Request.ServerVariables["PATH_INFO"])%>

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

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

以上的代码在http://localhost/MES/admin/WebForm1.aspx页面
运行结果:

C:\Inetpub\wwwroot\MES/admin\WebForm1.aspx

C:\Inetpub\wwwroot\
C:\Inetpub\wwwroot\MES/admin
C:\Inetpub\wwwroot\MES/admin

C:\Inetpub\wwwroot\MES\
C:\Inetpub\wwwroot\MES

相关文章:

  • 2022-01-11
  • 2022-12-23
  • 2022-01-12
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-11-17
相关资源
相似解决方案