ASP. NET background Gets the file name of the current page
System.IO.Path.GetFileName (Request.path). ToString ();
Get the current page file name, parameters, domain name and other methods
Assuming the current page full address is: Http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
"/HTTP" is the protocol name
"Www.test.com" is the domain name
"AAA" is the virtual directory name
"Bbb.aspx" is the page name (file name)
"Id=5&name=kelli" is a parameter
"1" gets the full URL (protocol name + domain + virtual directory name + filename + parameter)
String url=request.url.tostring ();
Url= Http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
"2" gets the virtual directory name + page name + parameters:
String Url=request.rawurl;
(or string url=request.url.pathandquery;)
Url=/aaa/bbb.aspx?id=5&name=kelli
"3" gets the virtual directory 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
request.querystring["id" and request.querystring["name"] access to each parameter
Request.urlreferrer can get information about the URL that the client last requested, so that we can return to "previous page" through this property.
Similarly, Request.UrlReferrer.Query can get the relevant parameters section of the URL that the client last requested.
Request.applicationpath:/testweb
Request.currentexecutionfilepath:/testweb/default.aspx
Request.filepath:/testweb/default.aspx
Request.path:/testweb/default.aspx
Request.pathinfo:
Request.physicalapplicationpath:e:\www\testweb\
Request.physicalpath:e:\www\testweb\default.aspx
Request.rawurl:/testweb/default.aspx
Request.Url.AbsolutePath:/testweb/default.aspx
Request.url.absoluteuri:http://www.test.com/testweb/default.aspx
Request.Url.Host:www.test.com
Request.Url.LocalPath:/testweb/default.aspx
ASP. NET gets the file name, parameters, domain name and other methods of the current page