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


This content was proof-read by Grammarly. You can Try Grammary for FREE

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 ?
%d bloggers like this: