asp.net Server.MapPath
2012-07-08 12:47
232 查看
./当前目录
/网站主目录
../上层目录
~/网站虚拟目录
如果当前的网站目录为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
/网站主目录
../上层目录
~/网站虚拟目录
如果当前的网站目录为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
相关文章推荐
- ASP.NET获取各级目录位置Server.MapPath详解全
- asp.net中Server.MapPath的使用
- ASP.NET Request.MapPath() 与 Server.MapPath()
- ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath(转载)
- ASP.NET - 在类中如何使用 Server.MapPath
- ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath的区别
- asp.net .ashx,cs文件使用server.mappath解决方法
- ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath的区别
- ASP.NET中Server.MapPath
- asp.net .ashx,cs文件使用server.mappath解决方法
- asp.net .ashx文件使用Server.MapPath解决方法
- asp.net .ashx文件使用Server.MapPath解决方法
- ASP.NET在类中引用Application和Server.MapPath
- 【ASP.NET】--Server.MapPath()
- asp.net .ashx文件使用server.mappath解决方法
- ASP.NET中Server.MapPath() 和 Request.MapPath()使用区别(于三份资料中提取)
- ASP.NET获取各级目录Server.MapPath详解全
- ASP.NET中Server.MapPath的几种用法
- asp.net .ashx,cs文件使用server.mappath解决方法
- asp.net .ashx,cs文件使用server.mappath解决方法