澳门新葡亰553311b > 新葡亰 计算机网络 > ServerVariables[URL]、Url、RawUrl、Path 区别

ServerVariables[URL]、Url、RawUrl、Path 区别
2020-02-06 21:16

代码是:

测试的url地址是http://www.gkxsn.com/testweb/default.aspx?id=1, 结果如下:
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PathInfo:
Request.PhysicalApplicationPath: E:WWWtestweb
Request.PhysicalPath: E:WWWtestwebdefault.aspx
Request.RawUrl: /testweb/default.aspx?id=1
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUri: http://www.gkxsn.com/testweb/default.aspx?id=1
Request.Url.Host: www.gkxsn.com
Request.Url.LocalPath: /testweb/default.aspx
Response.Write("<b>Request.ApplicationPath:</b> " + Request.ApplicationPath + "<br>");
Response.Write("<b>Request.CurrentExecutionFilePath:</b> " + Request.CurrentExecutionFilePath + "<br>");
Response.Write("<b>Request.FilePath:</b> " + Request.FilePath + "<br>");
Response.Write("<b>Request.Path:</b> " + Request.Path + "<br>");
Response.Write("<b>Request.PathInfo:</b> " + Request.PathInfo + "<br>");
Response.Write("<b>Request.PhysicalApplicationPath:</b> " + Request.PhysicalApplicationPath + "<br>");
Response.Write("<b>Request.PhysicalPath:</b> " + Request.PhysicalPath + "<br>");
Response.Write("<b>Request.RawUrl:</b> " + Request.RawUrl + "<br>");
Response.Write("<b>Request.Url.AbsolutePath:</b> " + Request.Url.AbsolutePath + "<br>");
Response.Write("<b>Request.Url.AbsoluteUri:</b> " + Request.Url.AbsoluteUri + "<br>");
Response.Write("<b>Request.Url.Host:</b> " + Request.Url.Host + "<br>");
Response.Write("<b>Request.Url.LocalPath:</b> " + Request.Url.LocalPath + "<br>");

  • Response.Write(Request.ServerVariables["URL"] + "<br>");
  • Response.Write(Request.Url + "<br>");
  • Response.Write(Request.RawUrl + "<br>");
  • Response.Write(Request.Path + "<br>");

测试 URL:

结果:

  • /Default.aspx
  • /Default.aspx?action=delete
  • /Default.aspx

测试 URL:

结果:

  • /default.aspx
  • /default.aspx?cacheaction=delete
  • /default.aspx
上一篇:希腊字母表 下一篇:没有了