How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

If you want to retrieve the URL of the current Page in a ASP.NET MVC 4 Controller , you can get it by using the AbsoluteUri property defined in the Request.Url class.

How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

using System;
using System.Linq;

using System.Web;

using System.Web.Mvc;

namespace MvcApplication1.Controllers

{

public class EmployeeController : Controller

{

//

// GET: //AbundantCode Employee Action
public ActionResult Index()

{

string CurrentURL = Request.Url.AbsoluteUri;

return View(CurrentURL);

}

}

}
How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

0saves
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.
Pin It

One thought on “How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

  1. Pingback: Interesting .NET Links - February 19 , 2013 | TechBlog

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>