LearnFast.Ninja

Get full url C# ASP.NET

In this tutorial you will see few ways to get full URL from your current page. We also recommended to add ToLower() function to avoid bugs. Use HttpContext if you want to get the current page when you do not have instance of the current page class, for example when using web service.

Option 1:
Request.Url.ToString();

Option 2:
HttpContext.Current.Request.Url.ToString();

Option 3:
Request.Url.AbsoluteUri.ToString();

Option 4:
HttpContext.Current.Request.Url.AbsoluteUri.ToString();

Result:
http://www.yourdomain.com/test.aspx?a=1&b=2&c=3

Tags

asp.net

get-url url absolute-url uri