How to get the URL of the current page in ASP.NET MVC Action Method ?

If you want to get the current URL from an action method in ASP.NET MVC project , you can use the Request.Url.AbsoluteUri property .

How to get the URL of the current page in ASP.NET MVC Action Method ?

Below is a sample code snippet demonstrating how to get the current URL in ASP.NET MVC.

public ActionResult Index()
{
    string CompleteUrl = this.Request.Url.AbsoluteUri;
    return View();
}

image

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply