How do I get the referrer URL in an ASP.NET MVC action?

Ryall picture Ryall · Sep 24, 2009 · Viewed 84.9k times · Source

How do I get the referrer URL in an ASP.NET MVC action? I am trying to redirect back to the page before you called an action.

Answer

Derek Lawless picture Derek Lawless · Sep 24, 2009

You can use Request.UrlReferrer to get the referring URL as well if you don't like accessing the Request.ServerVariables dictionary directly.