http://www.cnblogs.com/yangfan/archive/2008/05/23/1205976.html
./当前目录
/网站主目录
../上层目录
~/网站虚拟目录
如果当前的网站目录为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
server.MapPath(request.ServerVariables("Path_Info"))
Request.ServerVariables("Path_Translated")
上面两种方式返回路径为 D:\wwwroot\company\news\show.asp
本文详细解释了Server.MapPath()函数在不同路径参数下的作用,并通过具体示例展示了如何获取当前网站及应用程序目录下的绝对路径。
241

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



