教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 Server.MapPath方法的应用方法

Server.MapPath方法的应用方法

发布时间:2018-09-18   编辑:jiaochengji.com
教程集为您提供Server.MapPath方法的应用方法 等资源,欢迎您收藏本站,我们将为您提供最新的Server.MapPath方法的应用方法 资源

Server.MapPath方法的应用方法

总注:Server.MapPath获得的路径都是服务器上的物理路径,也就是常说的绝对路径
1、Server.MapPath("/")
注:获得应用程序根目录所在的位置,如 C:Inetpubwwwroot。
2、Server.MapPath("./")
注:获得所在页面的当前目录,等价于Server.MapPath("")。
3、Server.MapPath("../")
注:获得所在页面的上级目录。
4、Server.MapPath("~/")
注:获得当前应用级程序的目录,如果是根目录,就是根目录,如果是虚拟目录,就是虚拟目录所在的位置,如C:InetpubwwwrootExample。

 

./当前目录
/request.ServerVariables("Path_Info"))
Request.ServerVariables("Path_Translated") 
上面两种方式返回路径为 D:wwwrootcompanynewsshow.asp

 

您可能感兴趣的文章:
Server.MapPath方法的应用方法
asp获得虚拟主机的相对地址
asp Server.MapPath的用法介绍
asp 删除图片与文件函数
asp.net c# 文件 复制 移动 删除方法
asp.net获取网站目录物理路径
Server.MapPath方法测试结果
asp 连接access数据库二种方法
ASP.NET 数据库连接方式
Farpoint操作excel的用法举例

[关闭]
~ ~