zoukankan      html  css  js  c++  java
  • request获取url的方法总结

     辣么多属性、方法  不用就忘了  ,当需要用的时候挠头也想不到,现在总结一下 以备用

    例如:http://localhost/testweb/default.aspx

    1.Request.ApplicationPath;  获取服务器上ASP.NET应用程序的虚拟应用程序根路径

    2.Request.AppRelativeCurrentExecutionFilePath;  获取应用程序根的虚拟路径,使用~使成为相对路径
    3. Request.CurrentExecutionFilePath;  获取当前请求的虚拟路径
    4.Request.FilePath;    获取当前请求的虚拟路径
    5.Request.MapPath("virtualpath"); 将指定虚拟路径映射到物理路径
    6.Request.Path;   获取当前请求的虚拟路径
    7.Request.PathInfo; 获取具有url扩展名的资源的附加路径信息
    8.Request.PhysicalApplicationPath; 获取当前正在执行的服务器应用程序的根目录的物理文件系统路径
    9.Request.PhysicalPath; 获取与请求的url相对应的物理文件系统路径
    10.Request.RawUrl;获取当前请求的原始url
    11.Request.Url  获取当前请求的url

    Request.Url.AbsolutePath: /testweb/default.aspx
    Request.Url.AbsoluteUri: http://www.test.com/testweb/default.aspx
    Request.Url.Host: www.test.com
    Request.Url.LocalPath: /testweb/default.aspx

    12.Request.UrlReferrer 获取客户端上次请求的url信息,该请求连接到当前url

    --ServerVariables :获取web服务器变量的集合

                      foreach (string r in Request.ServerVariables)
                      {
                          Response.Write(r + ">>>" + Request.ServerVariables[r] + "<hr>");
                      }

  • 相关阅读:
    摘金奇缘在线观看迅雷下载
    无敌破坏王2:大闹互联网在线观看
    神奇动物:格林德沃之罪电影在线观看
    你好,之华
    毒液:致命守护者
    apache 通过ajp访问tomcat多个站点
    docker使用大全 tomcat安装
    Log4j2 + Maven的配置文件示例详解
    centos7 设置tomcat自启动
    nginx多站路由配置tomcat
  • 原文地址:https://www.cnblogs.com/yuanyanyan/p/5473816.html
Copyright © 2011-2022 走看看