1、经由过程C#猎取当前页面的URL
string url = Request.Url.AbsoluteUri; //效果: <a href="http://www.mystudy.cn/web/index.aspx" target="_blank">http://www.mystudy.cn/web/index.aspx</a> string host = Request.Url.Host; //效果:www.mystudy.cn string rawUrl = Request.RawUrl; //效果:/web/index.aspx string localPath = Request.Url.LocalPath; //效果:/web/index.aspx
2、经由过程Javascript猎取当前页面的URL
var url = document.URL; //效果:http://www.mystudy.cn/web/index.aspx var href = document.location.href; //效果:http://www.mystudy.cn/web/index.aspx var host = location.hostname; //效果:www.mystudy.cn
以上就是C#猎取当前页面的URL示例代码的内容,更多相关内容请关注ki4网(www.ki4.cn)!