zoukankan      html  css  js  c++  java
  • .net 获取当前网页的的url

    一、路径获取方法

    如果测试的url地址是http://www.test.com/testweb/default.aspx 通过ASP.NET获取结果如下:
    Request.ApplicationPath:                /testweb
    Request.CurrentExecutionFilePath:       /testweb/default.aspx
    Request.FilePath:                       /testweb/default.aspx
    Request.Path:                           /testweb/default.aspx
    Request.PhysicalApplicationPath:        E:\WWW\testweb
    Request.PhysicalPath: E:\WWW\testweb\default.aspx Request.RawUrl: /testweb/default.aspx 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

     

    2020-6-18更新

    二、Request.Url和Request.RawUrl详解

    Request.Url 获取静态地址

    如果测试的静态地址是Url:https://www.test.web/zt/210662/zq.html,而它对应的实际web目录是https://www.test.web/zt/spacepage.aspx

    通过ASP.NET获取结果如下:
    Request.Url:               https://www.test.web/zt/spacepage.aspx
    Request.RawUrl:           /zt/210662/zq.html
    Request.Url.AbsoluteUri:    https://www.test.web/zt/spacepage.aspx
    Request.Url.AbsolutePath:    /zt/spacepage.aspx

     
    Request.Url获取的地址并不是 https://www.test.web/zt/210662/zq.html
    如果本文引用了你的文章而未注明,请及时联系我。
  • 相关阅读:
    Windows 8.1 Visual Studio 2013 OpenGL 配置
    panic 和 recover的区别
    Beego操作数据库
    sql 中 inner join、left join 和 right join的区别
    Go实现网页爬虫
    SqlServer中 不区分大小写 和 全半角的写法
    循环语句
    switch语句
    iota枚举
    关于Go开发工具(LiteIDE)
  • 原文地址:https://www.cnblogs.com/sunxi/p/2571613.html
Copyright © 2011-2022 走看看