×

Server.MapPath用法

管理员 管理员 发表于2008-06-21 07:01:55 浏览3219 评论0

抢沙发发表评论

 ./当前目录
/根目录
../上层目录(相对当前来说)

如果当前的网站目录为D:\wwwroot    浏览的页面路径为D:\wwwroot\company\news\show.asp
在show.asp页面中使用
Server.MapPath("./")   返回路径为:D:\wwwroot\company\news
Server.MapPath("/")    返回路径为:D:\wwwroot
Server.MapPath("../")   返回路径为:D:\wwwroot\company
server.MapPath(request.ServerVariables("Path_Info")) 
Request.ServerVariables("Path_Translated")  
上面两种方式返回路径为 D:\wwwroot\company\news\show.asp

群贤毕至

访客