Uri 与 Request 信息测试

   Uri baseUri = new Uri("http://www.csdn.net/");
   Uri myUri = new Uri(baseUri, "catalog/file.htm?id=abc#top");

   this.Response.Write("Uri.AbsolutePath: " + myUri.AbsolutePath + "<br>");
   this.Response.Write("Uri.Query: " + myUri.Query + "<br>");
   this.Response.Write("Uri.PathAndQuery: " + myUri.PathAndQuery + "<br>");
   this.Response.Write("Uri.Scheme: " + myUri.Scheme + "<br>");
   this.Response.Write("Uri.Host: " + myUri.Host + "<br>");
   this.Response.Write("Uri.HostNameType: " + myUri.HostNameType + "<br>");
   this.Response.Write("Uri.Port: " + myUri.Port + "<br>");
   this.Response.Write("Uri.Fragment: " + myUri.Fragment + "<br>");
   this.Response.Write("Uri.Authority: " + myUri.Authority + "<br>");
   this.Response.Write("Uri.AbsoluteUri: " + myUri.AbsoluteUri + "<br>");

   this.Response.Write("======Request======<br>");
   this.Response.Write("Request.Path: " + this.Request.Path + "<br>");
   this.Response.Write("Request.FilePath: " + this.Request.FilePath + "<br>");
   this.Response.Write("Request.PathInfo: " + this.Request.PathInfo + "<br>");
   this.Response.Write("Request.RawUrl: " + this.Request.RawUrl + "<br>");
   this.Response.Write("Request.UrlReferrer: " + this.Request.UrlReferrer + "<br>");
   this.Response.Write("Request.PhysicalApplicationPath: "+this.Request.PhysicalApplicationPath+"<br>");
   this.Response.Write("Request.PhysicalPath: " + this.Request.PhysicalPath + "<br>");

  输出结果:
   Uri.AbsolutePath: /catalog/file.htm
   Uri.Query: ?id=abc
   Uri.PathAndQuery: /catalog/file.htm?id=abc
   Uri.Scheme: http
   Uri.Host: www.csdn.net
   Uri.HostNameType: Dns
   Uri.Port: 80
   Uri.Fragment: #top
   Uri.Authority: www.csdn.net
   Uri.AbsoluteUri: http://www.csdn.net/catalog/file.htm?id=abc#top
   ======Request======
   Request.Path: /QCLJCommunity/Web/default.aspx/tt
   Request.FilePath: /QCLJCommunity/Web/default.aspx
   Request.PathInfo: /tt
   Request.RawUrl: /QCLJCommunity/Web/default.aspx/tt?fileid=12
   Request.UrlReferrer: http://localhost/QCLJCommunity/Web/default.aspx?file=1
   Request.PhysicalApplicationPath: D:\程序\QCLJ\QCLJCommunity\Web\
   Request.PhysicalPath: D:\程序\QCLJ\QCLJCommunity\Web\default.aspx

posted on 2005-11-21 16:38  tianxd  阅读(951)  评论(0编辑  收藏  举报

导航