获取URL:  
   1、通过ASP.NET获取  
   如果测试的url地址是http://www.test.com/testweb/default.aspx,   结果如下:  
    
   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.AbsoluteUrl:                                 http://www.test.com/testweb/default.aspx  
   Request.Url.Host:                                               www.test.com  
   Request.Url.LocalPath:                                     /testweb/default.aspx    
    
   2、通过JS获取  
    
   <table   width=100%   cellpadding=0   cellspacing=0   border=0   >      
   <script>        
   thisURL   =   document.URL;  
   thisHREF   =   document.location.href;    
   thisSLoc   =   self.location.href;        
   thisDLoc   =   document.location;        
   strwrite   =   "<tr><td   valign=top>thisURL:   </td><td>["   +   thisURL   +   "]</td></tr>"strwrite   +=   "<tr><td   valign=top>thisHREF:   </td><td>["   +   thisHREF   +   "]</td></tr>" strwrite   +=   "<tr><td   valign=top>thisSLoc:   </td><td>["   +   thisSLoc   +   "]</td></tr>" strwrite   +=   "<tr><td   valign=top>thisDLoc:   </td><td>["   +   thisDLoc   +   "]</td></tr>" document.write(   strwrite   );    
   </script>    
   thisDLoc   =   document.location;   <BR>      
   thisURL   =   document.URL;   <BR>      
   thisHREF   =   document.location.href;   <BR>      
   thisSLoc   =   self.location.href;<BR>      
   <script>        
   thisTLoc   =   top.location.href;        
   thisPLoc   =   parent.document.location;      
   thisTHost   =   top.location.hostname;      
   thisHost   =   location.hostname;        
   strwrite   =   "<tr><td   valign=top>thisTLoc:   </td><td>["   +   thisTLoc   +   "]</td></tr>"strwrite   +=   "<tr><td   valign=top>thisPLoc:   </td><td>["   +   thisPLoc   +   "]</td></tr>"strwrite   +=   "<tr><td   valign=top>thisTHost:   </td><td>["   +   thisTHost   +   "]</td></tr>"strwrite   +=   "<tr><td   valign=top>thisHost:   </td><td>["   +   thisHost   +   "]</td></tr>"document.write(   strwrite   );  
   </script>    
   thisTLoc   =   top.location.href;   <BR>    
   thisPLoc   =   parent.document.location;   <BR>      
   thisTHost   =   top.location.hostname;   <BR>      
   thisHost   =   location.hostname;<BR>      
   <script>        
   tmpHPage   =   thisHREF.split(   "/"   );        
   thisHPage   =   tmpHPage[   tmpHPage.length-1   ];        
   tmpUPage   =   thisURL.split(   "/"   );        
   thisUPage   =   tmpUPage[   tmpUPage.length-1   ];      
   strwrite   =   "<tr><td   valign=top>thisHPage:   </td><td>["   +   thisHPage   +   "]</td></tr>"      
   strwrite   +=   "<tr><td   valign=top>thisUPage:   </td><td>["   +   thisUPage   +   "]</td></tr>"        
   document.write(   strwrite   );    
   </script><tr><td>  

转载于:https://www.cnblogs.com/huangzj1010/archive/2010/07/21/1782055.html

.net获取地址栏中的url相关推荐

  1. php 正则替换url参数,JavaScript正则获取地址栏中参数的方法分享

    这篇文章主要介绍了JavaScript正则获取地址栏中参数的方法,涉及javascript基于正则的字符串截取操作相关实现技巧,需要的朋友可以参考下 本文实例讲述了JavaScript正则获取地址栏中 ...

  2. JavaScript获取地址栏中的链接参数

    2019独角兽企业重金招聘Python工程师标准>>> JavaScript获取地址栏中的链接参数 <script type="text/javascript&quo ...

  3. js获取地址栏中的参数

    1.单个参数获取 比如url: http://127.0.0.1:8080/index.html?oid=11000001 // 获取地址栏中的id参数var path = window.locati ...

  4. 在浏览器地址栏中输入URL后发生了什么

    在浏览器地址栏中输入URL后发生了什么 基本流程: ①查询ip地址 ②建立tcp连接,接入服务器 ③浏览器发起http请求 ④服务器后台操作并做出http响应 ⑤网页的解析与渲染 详细步骤如下: 查询 ...

  5. php 获取字符串中的url,php使用正则表达式获取字符串中的URL

    今天写一个问答系统上线之后发现有很多人发链接了,由于业务部门要我们过滤掉网站地址了,下面我给大家分享一个提取字符串url地址函数,代码如下:$str ='本文实例讲述了php匹配字符串里所有URL地址 ...

  6. 怎么查onedrive的服务器位置,获取组织中OneDrive URL 的列表

    获取组织中OneDrive URL 的列表 2021/6/26 本文内容 本文适用于 Microsoft 365 中的全局SharePoint管理员. 查看组织中OneDrive用户和 URL 的列表 ...

  7. JS中获取地址栏中的参数

    访问地址: var name="中文测试名称"; var name="性别"; var url=contextPath+"/demo.jsp?name ...

  8. php正则截取富文本编辑器中路径字符串_php使用正则表达式获取字符串中的URL

    今天写一个问答系统上线之后发现有很多人发链接了,由于业务部门要我们过滤掉网站地址了,下面我给大家分享一个提取字符串url地址函数,代码如下: $str ='本文实例讲述了php匹配字符串里所有URL地 ...

  9. php正则 网址,php使用正则表达式获取字符串中的URL

    今天写一个问答系统上线之后发现有很多人发链接了,由于业务部门要我们过滤掉网站地址了,下面我给大家分享一个提取字符串url地址函数,代码如下: $str ='本文实例讲述了php匹配字符串里所有URL地 ...

最新文章

  1. 用mysql做文本挖掘_手把手教你做文本挖掘
  2. CentOS6.5环境使用keepalived实现nginx服务的高可用性及配置详解
  3. js获取浏览器活跃页面,切换tab页状态
  4. python 多线程 线程如何获得返回值 (重写threading.Thread类)
  5. 算法题解:动态规划解0-1背包问题
  6. 字典:散列表、散列字典、关键字列表、集合与结构体
  7. 前端学习(662):逻辑运算符练习
  8. Spring Boot基础学习笔记:可视化数据
  9. videojs中文文档详解_你的项目需要一个高质量README文档!
  10. Android 缓存处理和图片处理
  11. 驻马店市机器人科技馆_科技创新体验馆,科技馆机器人
  12. 【毕业设计】JSP数据库连接池的研究与实现(源代码+论文)
  13. mysql最大、第二、第三
  14. 365锦鲤助手修改版,砍价小程序
  15. 华为PUSH 日常问题解决方案
  16. PowerBI系列之什么是PowerBI
  17. 【No server address listed in hbase:meta for region XX】
  18. Android app本地切换logo和名称
  19. java的博_小博老师解析Java核心技术 ——I/O流
  20. POI入力自定义格式数据

热门文章

  1. STM32F4 HAL库开发 -- 独立看门狗(IWDG)
  2. STM32开发 -- UTC、UNIX时间戳、北京时间之间的转换
  3. UNIX再学习 -- 线程控制
  4. Android VNC Server
  5. ICLR 2017 | Attention 和 Memory Networks
  6. 两种AIDL用法分析(原)
  7. Sparkmllib scala逻辑回归
  8. intellij idea 2018 license 可用无废话
  9. db2 replace函数的用法_SQL基础知识:常用字符处理函数
  10. QGraphicsScene 的简单理解--关于手册的简要翻译