Get full URL (protocol name + domain + site name + filename + parameter)
String fullurl = Request.Url.ToString ();
Gets the URL information requested by the client (excluding hosts and ports)
string rawurl = Request.rawurl;
Get Site name + page name
string absolutepath = Request.Url.AbsolutePath;
Get host part
string urlhost = Request.Url.Host;
Get the Parameters section
string urlquery = Request.Url.Query;
To get the virtual path to the ASP.net application on the server
string applicationpath = Request.applicationpath;
Gets the virtual path of the current request
string currentexecutionfilepath = Request.currentexecutionfilepath;
Gets the virtual path of the current request
string Path = Request.path;
Get additional path information for a resource with a URL extension
string pathinfo = Request.pathinfo;
Gets the physical file system path that corresponds to the requested URL
string physicalpath = Request.PhysicalPath;
Gets the local operating system representation of the file name
string localpath = Request.Url.LocalPath;
Get absolute URL
string Absoluteuri = Request.Url.AbsoluteUri;
Complete code Demo
Copy Code code as follows:
StringBuilder sb = new StringBuilder ();
Sb. Append ("Get the complete URL (protocol name + domain name + site names + filename + parameter):" + fullurl + "<br/>");
Sb. Append ("Get the URL information requested by the client (excluding host and port):" + Rawurl + "<br/>");
Sb. Append ("Get the Site name + page name:" + Absolutepath + "<br/>");
Sb. Append ("Get host part:" + urlhost + "<br/>");
Sb. Append ("Get parameter part:" + urlquery + "<br/>");
Sb. Append ("Get the application's virtual application root path:" + Applicationpath + "<br/>");
Sb. Append ("Get the virtual path of the current request:" + path + "<br/>");
Sb. Append ("Get additional path information for a resource with a URL extension:" + pathinfo + "<br/>");
Sb. Append ("Get the physical file system path corresponding to the requested URL:" + physicalpath + "<br/>");
Sb. Append ("Obtain the local operating system representation of the filename:" + localpath + "<br/>");
Sb. Append ("Get absolute URL:" + Absoluteuri + "<br/>");
Response.Write (sb.) ToString ());