ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath
1.Request.ApplicationPath->当前应用的目录
2.Request.FilePath->对应于iis的虚拟目录
如 URL http://mockte.com/1/index.html/pathinfo
FilePath = /1/index.html
3.Request.Path->当前请求的虚拟路径
Path 是 FilePath 和 PathInfo 尾部的串联。例如 URL http://mockte.com/1/index.html/pathinfo
那么Path = /1/index.html/pathinfo
4.Request.MapPath(string url)->将url映射为iis上的虚拟目录
这个目录都是相对于application的根目录的
于Server.MapPath相比,不会包含类似c:/这样的路径
可以理解为是相对路径(对比的Server.MapPath就是绝对路径)
5.Server.MapPath(string url)->将url映射为服务器上的物理路径
例如 http://mockte.com/1/index.html 假设你的应用程序在c:/iis/MySite中
那么就是 c:/iis/MySite/1/index.html
6.底下这张表就是根据Browser Request 的网址相关的属性的用法
| 网址:http://localhost:1897/News/Press/Content.aspx/123?id=1#toc | |
| Request.ApplicationPath | / |
| Request.PhysicalPath | D:/Projects/Solution/web/News/Press/Content.aspx |
| System.IO.Path.GetDirectoryName(Request.PhysicalPath) | D:/Projects/Solution/web/News/Press |
| Request.PhysicalApplicationPath | D:/Projects/Solution/web/ |
| System.IO.Path.GetFileName(Request.PhysicalPath) | Content.aspx |
| Request.CurrentExecutionFilePath | /News/Press/Content.aspx |
| Request.FilePath | /News/Press/Content.aspx |
| Request.Path | /News/Press/Content.aspx/123 |
| Request.RawUrl | /News/Press/Content.aspx/123?id=1 |
| Request.Url.AbsolutePath | /News/Press/Content.aspx/123 |
| Request.Url.AbsoluteUri | http://localhost:1897/News/Press/Content.aspx/123?id=1 |
| Request.Url.Scheme | http |
| Request.Url.Host | localhost |
| Request.Url.Port | 1897 |
| Request.Url.Authority | localhost:1897 |
| Request.Url.LocalPath | /News/Press/Content.aspx/123 |
| Request.PathInfo | /123 |
| Request.Url.PathAndQuery | /News/Press/Content.aspx/123?id=1 |
| Request.Url.Query | ?id=1 |
| Request.Url.Fragment | |
| Request.Url.Segments | / News/ Press/ Content.aspx/ 123 |
ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath的更多相关文章
- ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、Server.MapPath(转载)
1.Request.ApplicationPath->当前应用的目录 Jsp中, ApplicationPath指的是当前的application(应用程序)的目录,ASP.NET中也是这个 ...
- ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath、
1.Request.ApplicationPath->当前应用的目录 Jsp中, ApplicationPath指的是当前的application(应用程序)的目录,ASP.NET中也是这 ...
- Asp.net中Request.Url的各个属性对应的意义介绍
Asp.net中Request.Url的各个属性对应的意义介绍 本文转载自 http://www.jb51.net/article/30254.htm 网络上关于Request.Url的说明已经很多也 ...
- ASP.NET中的Request、Response、Server对象
Request对象 Response.Write(Request.ApplicationPath) //应用根路径 Request.AppRelativeCurrentExecutionFilePat ...
- asp.net中Response对象鱼Request对象
在asp.net中Response与Request对象是两个常用的对象,虽然他们长得有点像,但是作用却是截然不同,我们来看一下他们他们都有哪些不同. 一.Response对象主要作用:像浏览器输出信息 ...
- ASP.NET MVC从客户端中检测到有潜在危险的 Request.Form 值
ASP.NET MVC4(Razor)从客户端中检测到有潜在危险的 Request.Form 值 “/”应用程序中的服务器错误. 从客户端(Content=" sdfdddd ...&quo ...
- 转载 ASP.NET中如何取得Request URL的各个部分
转载原地址 http://blog.miniasp.com/post/2008/02/10/How-Do-I-Get-Paths-and-URL-fragments-from-the-HttpRequ ...
- ASP.NET 中Request.QueryString 中的key
在ASP.net中 的Key是可能为null的,例如在如下的Url中 http://localhost:14546/Home/Index?a 有一个key=null 其value是a,以前一直以为ke ...
- asp.net中Request.ServerVariables的用法
在asp.net中可以通过HttpRequest.ServerVariables 属性来获取“ Web 服务器变量的集合” HttpRequest.ServerVariables 的用法: HttpR ...
随机推荐
- [转载]软件测试之Web测试经典总结
转载自:软件测试之Web测试经典总结 基于Web的系统测试在基于Web的系统开发中,如果缺乏严格的过程,我们在开发.发布.实施和维护Web的过程中,可能就会碰到一些严重的问题,失败的可能性很大.而且, ...
- C++设计模式---职责链模式
职责链模式:使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系.将这个对象连成一条链,并沿这条链传递该请求,直到有一个对象处理它为止. 这里发出这个请求的客户端并不知道这当中的哪一 ...
- memkeys 安装时遇到的问题及解决办法
某天由于某需要,安装tumblr的开源工具memkeys .但还是一如既往地不是一帆风顺. 在./configure 时出现如下错误信息: configure.in:14: error: possib ...
- 005_MyEclipse编码设置
方法一: 1.打开MyEclipse,windows---->Preferences打开"首选项"对话框. 2.左侧导航,导航中找到general---->Worksp ...
- Monkey log分析说明
运行命令: adb shell monkey -p com.crazyhornets.MyHokageAndroidZSY -v -v -v 20 -- throttle 1000 Log: :Mon ...
- MVC 无法将类型“System.Collections.Generic.List<AnonymousType#1>”隐式转换为“System.Collections.Generic.IList<Mvc3Modeltest.Models.Movie>”。存在一个显式转换(是否缺少强制转换?))
1.问题: 2.解决方案:强制指定类型. 解决之.
- 当在类中的 Parcelable 接口使用 ArrayList < customObject > android 系统: nullPointerException
我想使调用音乐使用 parcelable,所以我可以访问两个不同的活动中的音乐的实例的类.我不想使用可序列化的速度的目的.当我尝试将它使用传递时,我总是收到 nullPointerException: ...
- erlang怎样有效监听大量并发连接
看了erlang的一些开源网络框架RabbitMQ.Ranch.他们都使用多个进程同一时候accept一个socket. 这样的方式在使得socketport监听的工作分担了很多其它的调度机会.可是, ...
- win32程序中简单应用mfc
今日写程序在win32中用CRect发现报错,突然想起来.要引入mfc库.想重新建立一个工程添加对mfc的支持.发现选项不能选.查资料后发现. 在win32程序中简单应用mfc库,只需要简单的引入&l ...
- How To Cluster Rabbit-MQ--reference
Foreword This explanation of clustering Rabbit-MQ assumes that you’ve had some experience with Rabbi ...