Suppose the current page full address is: http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
"Http: //" protocol name is
"Www.test.com" is the domain name
"Aaa" is the name of the site
"Bbb.aspx" is the page name (file name)
"Id = 5 & name = kelli" parameter
[1] For a complete url (protocol + domain name + domain name + file name + parameters)
string url=Request.Url.ToString();
url= http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
[2] to obtain the domain name + name + parameters page:
string url=Request.RawUrl;
(或 string url=Request.Url.PathAndQuery;)
url= /aaa/bbb.aspx?id=5&name=kelli
[3] to obtain the domain name + Page name:
string url=HttpContext.Current.Request.Url.AbsolutePath;
(或 string url= HttpContext.Current.Request.Path;)
url= aaa/bbb.aspx
[4] obtain the domain name:
string url=HttpContext.Current.Request.Url.Host;
url= www.test.com
[5] acquisition parameters:
string url= HttpContext.Current.Request.Url.Query;
url= ?id=5&name=kelli
Reproduced in: https: //www.cnblogs.com/Viki/archive/2012/03/14/2395463.html