To get the current page URL you could use HttpContext.Current.Request.Url:
1. To get the full URL with query string (if any) you could use:
string absoluteurl = HttpContext.Current.Request.Url.AbsoluteUri;
// https://localhost:80/test/Default.aspx?test=1
2. To get the path without the domain you could use:
string absolutepath = HttpContext.Current.Request.Url.AbsolutePath;
// /test/Default.aspx
3. To get the Host:
string host = HttpContext.Current.Request.Url.Host;
// localhost
Related TutorialsWhat is ASP.NET?
ASP.NET Session state
ASP.NET User Controls
ASP.NET Versions
How to …