手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >ASP.NET获取各级目录Server.MapPath详解全
ASP.NET获取各级目录Server.MapPath详解全
摘要:Server.MapPath("/")应用程序根目录所在的位置如C:InetpubwwwrootServer.MapPath("~/")表示...

Server.MapPath("/") 应用程序根目录所在的位置 如 C:Inetpubwwwroot

Server.MapPath("~/")表示当前应用级程序的目录,如果是根目录,就是根目录,如果是虚拟目录,就是虚拟目录所在的位置 如:C:InetpubwwwrootExample

Server.MapPath("./") 表示所在页面的当前目录 注:等价于Server.MapPath("") 返回 Server.MapPath("")所在页面的物理文件路径 :返回路径为:E:wwwrootcompanynews

Server.MapPath("../")表示上一级目录 :返回路径为:E:wwwrootcompany

App_Code文件夹下 类获取路径 HttpRuntime.AppDomainAppPath : 注:等效于Server.MapPath("~")。

server.MapPath(request.ServerVariables("Path_Info")),Request.ServerVariables("Path_Translated") 上面两种方式返回路径为 D:wwwrootcompanynewsshow.aspx

Server.MapPath(Request.ApplicationPath);和HttpRuntime.AppDomainAppPath有何区别?

对于:http://localhost/DllTest/DLayer.aspx

Server.MapPath( ".")---D:wwwrootDllTest

HttpRuntime.AppDomainAppPath---D:wwwrootDllTest

一个有最后的' ',一个没有

【ASP.NET获取各级目录Server.MapPath详解全】相关文章:

ASP.NET使用gridview获取当前行的索引值

ASP.NET OutputCache详解

ASP.NET检测到不安全 Request.Form 值解决方案汇总

ASP.NET防止页面刷新的两种解决方法

在ASP.NET 中实现单点登录

asp.net获取网站绝对路径案例详解

ASP.NET 多次提交的解决办法2

.NET读取所有目录下文件正则匹配文本电子邮件

ASP.NET上传文件的简单例子

ASP.NET表单验证方法详解第1/2页

精品推荐
分类导航