C#获取当前页面的url
C#获取当前页面的url
string a= Request.ApplicationPath; // /
string b = Request.CurrentExecutionFilePath; // /WebForm1.aspx
string c = Request.FilePath; // /WebForm1.aspx
string d = Request.PhysicalApplicationPath; // c:\users\纯访\documents\visual studio 2013\Projects\WebApplication4\WebApplication4\
string ee = Request.RawUrl; // /WebForm1.aspx
string f = Request.Url.AbsolutePath; // /WebForm1.aspx
string g = Request.Url.AbsoluteUri; // http://localhost:7251/WebForm1.aspx
string h = Request.Url.Host; // localhost
string i = Request.Url.LocalPath; // /WebForm1.aspx
JS 获取当前页面的url
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script>
document.write("=============1==============================================="+ "<br>");
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><br>";
strwrite += "<tr><td valign=top>thisHREF: </td><td>[" + thisHREF + "]</td></tr><br>";
strwrite += "<tr><td valign=top>thisSLoc: </td><td>[" + thisSLoc + "]</td></tr><br>";
strwrite += "<tr><td valign=top>thisDLoc: </td><td>[" + thisDLoc + "]</td></tr><br>";
document.write(strwrite);
document.write("<br>"+"=============1===============================================" + "<br>");
</script>
<script>
document.write("<br>" + "=============2===============================================" + "<br>");
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><br>";
strwrite += "<tr><td valign=top>thisPLoc: </td><td>[" + thisPLoc + "]</td></tr><br>";
strwrite += "<tr><td valign=top>thisTHost: </td><td>[" + thisTHost + "]</td></tr><br>";
strwrite += "<tr><td valign=top>thisHost: </td><td>[" + thisHost + "]</td></tr><br>";
document.write(strwrite);
document.write("<br>" + "=============2===============================================" + "<br>");
</script>
<script>
document.write("<br>" + "=============3===============================================" + "<br>");
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><br>";
strwrite += "<tr><td valign=top>thisUPage: </td><td>[" + thisUPage + "]</td></tr><br>";
document.write(strwrite);
document.write("<br>" + "=============3===============================================" + "<br>");
</script> </head>
<body>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tbody>=================条目=============================</tbody><br />
thisDLoc = document.location;
<br>
thisURL = document.URL;
<br>
thisHREF = document.location.href;
<br>
thisSLoc = self.location.href;
<br> thisTLoc = top.location.href;
<br>
thisPLoc = parent.document.location;
<br>
thisTHost = top.location.hostname;
<br>
thisHost = location.hostname;
<br> <tr><td>
</table>
</body>
</html>
效果:
=============1===============================================
thisURL: [http://localhost:7251/HtmlPage2.html]
thisHREF: [http://localhost:7251/HtmlPage2.html]
thisSLoc: [http://localhost:7251/HtmlPage2.html]
thisDLoc: [http://localhost:7251/HtmlPage2.html] =============1=============================================== =============2===============================================
thisTLoc: [http://localhost:7251/HtmlPage2.html]
thisPLoc: [http://localhost:7251/HtmlPage2.html]
thisTHost: [localhost]
thisHost: [localhost] =============2=============================================== =============3===============================================
thisHPage: [HtmlPage2.html]
thisUPage: [HtmlPage2.html] =============3===============================================
=================条目=============================
thisDLoc = document.location;
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
C#获取当前页面的url的更多相关文章
- 转载: js jquery 获取当前页面的url,获取frameset中指定的页面的url(有修改)
转载网址:http://blog.csdn.net/bestlxm/article/details/6800077 js jquery 怎么获取当前页面的url,获取frameset中指定的页面的ur ...
- js获取当前页面的URL并且截取?之后的数据,返回json
js获取当前页面的URL并且截取'?'之后的数据,返回json格式的数据 最近想要把学到的东西整理一下,以后方便查找,也是一种自我累积,如果有错误或者更好的,欢迎提出! 这篇文档主要是写关于获取页面的 ...
- js获取当前页面的url网址信息小汇总
在WEB开发中,时常会用到javascript来获取当前页面的url网址信息,在这里是我的一些获取url信息的小总结. 下面我们举例一个URL,然后获得它的各个组成部分:http://i.cnblog ...
- 获取当前页面的URL信息
以前在做网站的时候,经常会遇到当前页的分类高亮显示,以便让用户了解当前处于哪个页面.之前一直是在每个不同页面写方法.工程量大,也不便于修改.一直在想有什么简便的方法实现.后来在网上查到可以用获取当前U ...
- react获取当前页面的url参数
react获取当前页面的url参数,必须在url路由对应的组件上获取,在子组件上获取不到,为undefined,获取形如 /news/:id 的后面的参数 id this.props.match. ...
- 原生php如何获取当前页面的url
原生php如何获取当前页面的url? //php获取当前访问的完整url地址 function get_current_url(){ $current_url='http://'; if(isset( ...
- 用js获取当前页面的url的相关信息方法
当前页面对应的URL的一些属性: ( http://bbs.xxx.net/forum.php?mod=viewthread&tid=2709692&page=1&extra= ...
- 微信小程序-怎么获取当前页面的url
getCurrentPages() 函数用于获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面. https://developers.weixin.qq.com ...
- 微信小程序怎么获取当前页面的url
使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面. var pages = getCurrentPages() //获取加载的页面 var cur ...
随机推荐
- android中的命令安装与卸载
软件的安装: adb install apk的保存地址 卸载软件: adb uninstall package名
- HDU 4069 Squiggly Sudoku(DLX)(The 36th ACM/ICPC Asia Regional Fuzhou Site —— Online Contest)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4069 Problem Description Today we play a squiggly sud ...
- URAL 1876 Centipede's Morning(数学)
A centipede has 40 left feet and 40 right feet. It keeps a left slippers and b right slippers under ...
- C#写好的类库dll怎么在别人调用的时候也能看到注释?
菜单 Project -> 'xxxx' Properties -> Build -> Output -> 勾上 XML Documentation file
- paper 20 :color moments
图像的颜色特征是很重要的,其中颜色矩也是很重要的一部分.(还有一个关于图像颜色特征的review,对于image color写的比较全面).还有,我要强调一下,本blog上的链接都是Google学术上 ...
- PAT乙级 1014. 福尔摩斯的约会 (20)
1014. 福尔摩斯的约会 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 大侦探福尔摩斯接到一张奇怪的 ...
- PHP导出CSV文件
经常会碰到需要从数据库中导出数据到Excel文件,用一些开源的类库,比如PHPExcel,确实比较容易实现,但对大量数据的支持很不好,很容易到达PHP内存使用上限.这里的方法是利用fputcsv写CS ...
- Sublime Text 3 常用插件以及安装方法
安装Sublime Text 3插件的方法: 一.直接安装 安装Sublime text 2插件很方便,可以直接下载安装包解压缩到Packages目录(菜单->preferences->p ...
- ubuntu下配置tomcat
配置tomcat 1.解压 tar -zxvf apache-tomcat-7.0.53.tar.gz 2.修改/bin/catalina.sh cygwin=falsedarwin=falseos4 ...
- bash正则表达式
星号*: 匹配它前面的字符串或正则表达式任意次(包括0次). 比如:* 可能匹配的字符串有:... ...... 句号.: 匹配除换行符之外的任意一个字符. 比如:"112.",将 ...