string Server.MapPath(string path) 返回与Web服务器上的指定虚拟路径相对应的物理文件路径。 Server.MapPath(Request.ServerVariables["PATH_INFO"]) Server.MapPath("/") Server.MapPath("") Server.MapPath(".") Server.MapPath("../") Server.MapPath("..") Page.Request.ApplicationPath 以上的代码在
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 由以上可以知道: 要想获得要是建立的虚拟目录的网站的根目录可以这样使用: Server.MapPath(Page.Request.ApplicationPath)
asp.net下的文件路径:获得虚拟目录的网站的根目录
最新推荐文章于 2025-12-05 10:22:32 发布
本文介绍了在ASP.NET中如何使用Server.MapPath方法获取不同类型的物理路径,包括网站的根目录,并通过实例演示了该方法在不同参数下的具体应用。
49

被折叠的 条评论
为什么被折叠?



