Search code examples
asp.net-mvcreferer

How to get last page visited in a controller


is there a way to get or store the last page visited? Example if I'm on a List Page with a New link that loads a page with form. If the user cancels, you go back to the previous page (List Page).

Thanks


Solution

  • Well, in web forms, you would use: Request.UrlReferrer

    http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx

    So I assume you can also use that in MVC, accessible through the HttpContext property of the RequestContext acessible by teh controller.