亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#獲取當(dāng)前頁(yè)面的URL示例代碼

 更新時(shí)間:2013年11月03日 17:15:36   作者:  
獲取當(dāng)前頁(yè)面的URL在某些情況下還是比較使用的,下面為大家介紹下如何通過(guò)C#以及Javascript獲取當(dāng)前頁(yè)面的URL,感興趣的朋友不要錯(cuò)過(guò)
本實(shí)例的測(cè)試URL:http://www.mystudy.cn/web/index.aspx

1、通過(guò)C#獲取當(dāng)前頁(yè)面的URL
復(fù)制代碼 代碼如下:

string url = Request.Url.AbsoluteUri; //結(jié)果: http://www.mystudy.cn/web/index.aspx
string host = Request.Url.Host; //結(jié)果:www.mystudy.cn
string rawUrl = Request.RawUrl; //結(jié)果:/web/index.aspx
string localPath = Request.Url.LocalPath; //結(jié)果:/web/index.aspx

2、通過(guò)Javascript獲取當(dāng)前頁(yè)面的URL
復(fù)制代碼 代碼如下:

var url = document.URL; //結(jié)果:http://www.mystudy.cn/web/index.aspx
var href = document.location.href; //結(jié)果:http://www.mystudy.cn/web/index.aspx
var host = location.hostname; //結(jié)果:www.mystudy.cn

相關(guān)文章

最新評(píng)論