假設當前頁完整地址是:http://www.360jht.com/game/bbb.aspx?id=5&name=kelli
"http://"是協議名
"www.360jht.com"是域名
"game"是站點名
"bbb.aspx"是頁面名(檔名)
"id=5&name=kelli"是引數
【1】獲取 完整url (協議名+域名+站點名+檔名+引數)
string url=Request.Url.ToString();
url= http://www.360jht.com/aaa/bbb.aspx?id=5&name=kelli
【2】獲取 站點名+頁面名+引數:
string url=Request.RawUrl;
(或 string url=Request.Url.PathAndQuery;)
url= /game/bbb.aspx?id=5&name=kelli
【3】獲取 站點名+頁面名:
string url=HttpContext.Current.Request.Url.AbsolutePath;
(或 string url= HttpContext.Current.Request.Path;)
url= aaa/bbb.aspx
【4】獲取 域名:
string url=HttpContext.Current.Request.Url.Host;
url= www.test.com
【5】獲取 引數:
string url= HttpContext.Current.Request.Url.Query;
url= ?id=5&name=kelli
轉自:http://www.cnblogs.com/rhythmK/archive/2010/03/08/1680562.html