All about Programming and Sourcecode

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.
 
Comments

Trackbacks for this post

Leave a Reply