Asp.Net Example:How to get current page URL/Address in asp.net

In this article i am going to explain How to get/fetch/read current page URL/Address in asp.net using C#.

Here is C#.Net Code to get current page URL/Address in asp.net.

if your page full url is http://example.com/Default.aspx

1-Response.Write(Request.RawUrl);
 
  its output will be : /Default.aspx

2-Response.Write(HttpContext.Current.Request.Url.AbsolutePath);

  its output will be : /Default.aspx

3-Response.Write(Request.Url);

 its output will be : http://example.com/Default.aspx

4-Response.Write(HttpContext.Current.Request.Url);

 its output will be : http://example.com/Default.aspx

5- Response.Write(Request.Url.AbsoluteUri);

  its output will be : http://example.com/Default.aspx

6- Response.Write(HttpContext.Current.Request.Url.AbsoluteUri);

  its output will be : http://example.com/Default.aspx


Tags: ,

Join Us!