/ 网站主目录
./ 当前目录
../ 上层目录
~/ 网站虚拟目录
如果当前的网站目录为E:\wwwroot 应用程序虚拟目录为E:\wwwroot\company 浏览的页面路径为E:\wwwroot\company\news\show.asp
在show.asp页面中使用
Server.MapPath("./") 返回路径为:E:\wwwroot\company\news
Server.MapPath("/") 返回路径为:E:\wwwroot
Server.MapPath("../") 返回路径为:E:\wwwroot\company
Server.MapPath("~/") 返回路径为:E:\wwwroot\company
本文详细解释了在不同场景下使用相对路径(如 ./、../ 和 ~/)及绝对路径(/)时,服务器如何映射这些路径到实际文件系统路径。通过具体实例展示了各种路径标识符在Web应用程序中的实际应用。

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



