Set the full address of the current page to: http://www.jb51.net/aaa/bbb.aspx? Id = 5 & name = kelli
"Http: //" is the protocol name.
"Http://www.jb51.net/" is a domain name
"AAA" is the site name
"BBB. aspx" is the page name (file name)
"Id = 5 & name = Kelli" is a parameter
[1] obtain the complete URL (protocol name + domain name + site name + file name + parameter)
CodeAs follows:
String url = request. url. tostring ();
Url = http://www.jb51.net/aaa/bbb.aspx? Id = 5 & name = kelli
[2] retrieve 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
[3] retrieve 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
[4] retrieve domain names:
The Code is as follows:
String url = httpcontext. Current. Request. url. Host;
Url = http://www.jb51.net/
[5] GET parameters:
The Code is as follows:
String url = httpcontext. Current. Request. url. query;
Url =? Id = 5 & name = kelli
The Code is as follows:
Request. rawurl: Get the URL Information of the client request (excluding the host and port) ------>/default2.aspx
Request. applicationpath: obtain ASP. NET applications on the serverProgram. ------>/
Request. currentexecutionfilepath: Obtain the virtual path of the current request. ------>/Default2.aspx
Request. Path: Obtain the virtual path of the current request. ------>/Default2.aspx
Request. pathinfo: obtain the additional path information of the resource with the URL extension ------>
Request. physicalpath: Obtain the physical file system path corresponding to the requested URL. ------> E: \ temp \ default2.aspx
Request. url. localpath: ------>/default2.aspx
Request. url. absoluteuri: ------ & gt; http: // localhost: 8080/default2.aspx
Request. url. absolutepath: ---------------------------->/default2.aspx
Detailed source reference: http://www.jb51.net/article/24146.htm