码迷,mamicode.com
首页 > 移动开发 > 详细

Server.MapPath()目录详解

时间:2016-05-16 10:42:34      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

最近在做相关的开发,碰到了Server.MapPath(),顺便来温习一下
Server.MapPath()获取网站的目录详解 
  1. ./当前目录
  2. /网站主目录
  3. ../上层目录
  4. ~/网站虚拟目录
  • 如果当前的网站目录为E:\www123,应用程序虚拟目录为E:\www123\wlj ,浏览的页面路径为E:\www123\wlj\haha\heihei.asp。
  • 例子:heihei.asp页面中的具体使用如下
  • Server.MapPath("./")   返回路径为:E:\www123\wlj\haha
  • Server.MapPath("/")    返回路径为:E:\www123
  • Server.MapPath("../")   返回路径为:E:\www123\wlj
  • Server.MapPath("~/")   返回路径为:E:\www123\wlj
  • server.MapPath(request.ServerVariables("Path_Info")) 
  • Request.ServerVariables("Path_Translated") 
  • 上面两种方式返回路径为 D:\www123\wlj\haha\heihei.asp

Server.MapPath()目录详解

标签:

原文地址:http://www.cnblogs.com/1175429393wljblog/p/5497065.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!