URL 地址解析

//虚拟目录的路径
Response.Write("<strong>Request.ApplicationPath:</strong>" + Request.ApplicationPath + "</br>");
//站点的物理路径(完整路径)
Response.Write("<strong>Request.PhysicalPath:</strong>" + Request.PhysicalPath + "</br>");
//站点物理路径的目录
Response.Write("<strong>DirectoryName:</strong>" + System.IO.Path.GetDirectoryName(Request.PhysicalPath) + "</br>");
//站点物理路径的目录
Response.Write("<strong>Request.PhysicalApplicationPath:</strong>" + Request.PhysicalApplicationPath + "</br>");
//当前页面的文件名
Response.Write("<strong>FileName:</strong>" + System.IO.Path.GetFileName(Request.PhysicalPath) + "</br>");
//当前页面的虚拟路径
Response.Write("<strong>Request.CurrentExecutionFilePath:</strong>" + Request.CurrentExecutionFilePath + "</br>");
//当前页面的虚拟路径
Response.Write("<strong>Request.FilePath:</strong>" + Request.FilePath + "</br>");
Response.Write("<strong>Request.Path:</strong>" + Request.Path + "</br>");
//原始URL
Response.Write("<strong>Request.RawUrl:</strong>" + Request.RawUrl + "</br>");
//绝对路径(不包括参数什么的)
Response.Write("<strong>Request.Url.AbsolutePath:</strong>" + Request.Url.AbsolutePath + "</br>");
//绝对URL
Response.Write("<strong>Request.Url.AbsoluteUri:</strong>" + Request.Url.AbsoluteUri + "</br>");
//URL协议方案
Response.Write("<strong>Request.Url.Scheme:</strong>" + Request.Url.Scheme + "</br>");
//URL的主机名
Response.Write("<strong>Request.Url.Host:</strong>" + Request.Url.Host + "</br>");
//URL端口号
Response.Write("<strong>Request.Url.Port:</strong>" + Request.Url.Port + "</br>");
//主机名+端口号
Response.Write("<strong>Request.Url.Authority:</strong>" + Request.Url.Authority + "</br>");
//获取文件名的本地操作系统表现形式
Response.Write("<strong>Request.Url.LocalPath:</strong>" + Request.Url.LocalPath + "</br>");
//附加路径信息,例如http://wjnhome.com:88/UrlDemo.aspx/Hello?id=22#top 那么这里就是Hello
Response.Write("<strong>Request.PathInfo:</strong>" + Request.PathInfo + "</br>");
//URL的路径和GET参数
Response.Write("<strong>Request.Url.PathAndQuery:</strong>" + Request.Url.PathAndQuery + "</br>");
//URL的GET参数
Response.Write("<strong>Request.Url.Query:</strong>" + Request.Url.Query + "</br>");
//主要指的是http://wjnhome.com:88/UrlDemo.aspx/Hello?id=22#top中#后面的top。
//但一般情况下无法获取值,因为浏览器不会把这个值发送到服务器端
Response.Write("<strong>Request.Url.Fragment:</strong>" + Request.Url.Fragment + "</br>");
//主机名
Response.Write("<strong>Request.Url.DnsSafeHost:</strong>" + Request.Url.DnsSafeHost + "</br>");
//URL的全部
Response.Write("<strong>Request.Url.OriginalString:</strong>" + Request.Url.OriginalString + "</br>");
//这种情况 Uri uriAddress = new Uri ("http://user:password@www.contoso.com/index.htm ") Console.WriteLine(uriAddress.UserInfo);
Response.Write("<strong>Request.Url.UserInfo:</strong>" + Request.Url.UserInfo + "</br>");
//从某个页面跳转过来的时候会显示源页面的值
Response.Write("<strong>Request.UrlReferrer:</strong>" + Request.UrlReferrer + "</br>");
//URI的每一段
for (var i = 0; i < Request.Url.Segments.Length;i++ )
{
Response.Write("<strong>Request.Url.Segment" + i + ":</strong>" + Request.Url.Segments[i] + "</br>");
}

URL 地址解析

上一篇:WebAssembly初探


下一篇:PHP 里的三种文件时间表述方式 | 相关函数filemtime()、date()、diffForHumans()