1. ASP. NET gets the URL of the current URL
Reference Address: http://www.cnblogs.com/190196539/archive/2011/12/13/2286072.html
Set current page full address is: Http://www.jb51.net/aaa/bbb.aspx?id=5&name=kelli
"/HTTP" is the protocol name
"Www.jb51.net" is the domain name
"AAA" is the station name.
"Bbb.aspx" is the page name (file name)
"Id=5&name=kelli" is a parameter
"One" gets the full URL (protocol name + domain + site name + file name + parameter)
The code is as follows: String url=request.url.tostring ();
Url= Http://www.jb51.net/aaa/bbb.aspx?id=5&name=kelli
"Two" Get Site name + page name + parameters:
The code is as follows: string Url=request.rawurl;
(or string url=request.url.pathandquery;)
Url=/aaa/bbb.aspx?id=5&name=kelli
"Three" Get Site name + page name:
The code is as follows: string Url=httpcontext.current.request.url.absolutepath;
(or string url= HttpContext.Current.Request.Path;)
Url= aaa/bbb.aspx
"Four" Get Domain name:
The code is as follows: string url=httpcontext.current.request.url.host;
Url= www.jb51.net
"Five" Get Parameters:
The code is as follows: String url= HttpContext.Current.Request.Url.Query;
Url=? Id=5&name=kelli