asp.net gets the code for the of file name parameters domain name and so on for the various properties of the current web address url
- 2020-05-10 17:56:58
- OfStack
Set the current page is complete address: / / www ofstack. com/aaa/bbb aspx? id = 5 & name = kelli
"http://" is the protocol name
"www. ofstack. com" is the domain name
"aaa" is the name of the site
"bbb.aspx" is the page name (file name)
"id = = 5 & name kelli" is the parameter
[1] get the full url (protocol name + domain name + site name + file name + parameter)
string url=Request.Url.ToString();
url= //www.ofstack.com/aaa/bbb.aspx?id=5&name=kelli
[2] get site name + page name + parameter:
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] acquisition of domain name:
string url=HttpContext.Current.Request.Url.Host;
url= www.ofstack.com
[5] get parameters:
string url= HttpContext.Current.Request.Url.Query;
url= ?id=5&name=kelli
Request.RawUrl : to obtain the client's request URL Information (not including host and port) ------>/Default2.aspx
Request.ApplicationPath : get on the server ASP.NET The virtual path of the application. ------>/
Request.CurrentExecutionFilePath : gets the virtual path of the current request. ------>/Default2.aspx
Request.Path : gets the virtual path of the current request. ------>/Default2.aspx
Request.PathInfo : take a URL Additional path information for the resource with the extension ------>
Request.PhysicalPath : obtained and requested URL The corresponding physical file system path. ------>E:\temp\Default2.aspx
Request.Url.LocalPath : ------>/Default2.aspx
Request.Url.AbsoluteUri : ------>http://localhost:8080/Default2.aspx
Request.Url.AbsolutePath : ---------------------------->/Default2.aspx