浏览量: 次
HttpContext.Current.Request.Url.PathAndQuery
1、通过ASP.NET获取
如果测试的url地址是http://www.idc311.com/testweb/default.aspx, 结果如下:
Request.ApplicationPath:
Request.CurrentExecutionFilePath
Request.FilePath:
Request.Path:
Request.PhysicalApplicationPath:
Request.RawUrl:
Request.Url.AbsolutePath:
Request.Url.AbsoluteUrl:
Request.Url.Host:
Request.Url.LocalPath:
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>
上一篇:C# 哈希表Hashtable的增加,删除,遍历,排序下一篇:在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误
[声明]本网转载网络媒体稿件是为了传播更多的信息,此类稿件不代表本网观点,本网不承担此类稿件侵权行为的连带责任。故此,如果您发现本网站的内容侵犯了您的版权,请您的相关内容发至此邮箱【27535611@qq.com】,我们在确认后,会立即删除,保证您的版权。