Assuming the current page full address is: Http://www.test.com:80/aaa/bbb.aspx?id=5&name=kelli
"/HTTP" is the protocol name
"Www.test.com" is the domain name
"80" is the port number
"AAA" is the station name.
"Bbb.aspx" is the page name (file name)
"Id=5&name=kelli" is a parameter
"1" gets the full URL (protocol name + domain + site name + file name + parameter)
String url=request.url.tostring ();
Url=http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
"2" gets the site name + page name + parameters:
String Url=request.rawurl;
(or string url=request.url.pathandquery;)
Url=/aaa/bbb.aspx?id=5&name=kelli
"3" Get Site name + page name:
String Url=httpcontext.current.request.url.absolutepath;
(or string url= HttpContext.Current.Request.Path;)
Url=aaa/bbb.aspx
"4" Gets the domain name:
String Url=httpcontext.current.request.url.host;
Url=www.test.com
"5" gets the parameter:
String Url= HttpContext.Current.Request.Url.Query;
Url=?id=5&name=kelli
"5" Gets the port:
int port = HttpContext.Current.Request.Url.Port;
Port = 80
. NET get the current URL method of various properties (file name, parameter, domain name, port, etc.) (GO)