站在服务器磁盘上的物理路径: HttpRuntime.AppDomainAppPath
虚拟程序路径:
HttpRuntime.AppDomainAppVirtualPath
任何于Request/HttpContext.Current等相关的方法, 都只能在有请求上下文或者页面时使用.
即在无请求上下文时,HttpContext.Current为null. 而上面提到的方法一直可用.
对于全局Cache对象的访问亦然.
private
void responseHtml()
...{
System.Text.StringBuilder sb = new
System.Text.StringBuilder();
sb.Append(string.Format("当前时间:
{0}",
Server.HtmlEncode(DateTime.Now.ToString())));
sb.Append("
");
sb.Append(string.Format("当前请求的虚拟路径:
{0}",Server.HtmlEncode(Request.CurrentExecutionFilePath)));
sb.Append("
");
sb.Append(string.Format("获取当前应用程序的根目录路径: {0}",
Server.HtmlEncode(Request.ApplicationPath)));
sb.Append("
");
sb.Append(string.Format("当前请求的虚拟路径:
{0}",Server.HtmlEncode(Request.FilePath)));
sb.Append("
");
sb.Append(string.Format("当前请求的虚拟路径:
{0}",Server.HtmlEncode(Request.Path)));
sb.Append("
");
sb.Append(string.Format("获取当前正在执行的应用程序的根目录的物理文件系统路径: {0}",
Server.HtmlEncode(Request.PhysicalApplicationPath)));
sb.Append("
");
sb.Append(string.Format("获取与请求的 URL
相对应的物理文件系统路径: {0}",
Server.HtmlEncode(Request.PhysicalApplicationPath)));
sb.Append("
");
Response.Write(sb.ToString());
}
}
输出:当前时间: 2007-08-30
11:03:49
当前请求的虚拟路径: /aDirectory/Sample/responseHtml.asp教程x
获取当前应用程序的根目录路径:
/aDirectory
当前请求的虚拟路径: /aDirectory/Sample/responseHtml.aspx
当前请求的虚拟路径:
/aDirectory/Sample/responseHtml.aspx
获取当前正在执行的应用程序的根目录的物理文件系统路径: E:Visual
Studio 2005
获取与请求的 URL 相对应的物理文件系统路径: E:Visual Studio 2005aDirectory
当url中带参数时可以使用:
HttpContext.Current.Request.Url.PathAndQuery.ToString()//
本页地址: Request.URL;
上页地址:
Request.UrlReferrer
Request.ServerViables["http_referer"]
Request.RawUrl
Request.RawUrl.QueryAndPath
System.IO.Path.GetFileName(Request.FilePath.ToString())
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级