How to specify an area name in an action link?

Jeremy picture Jeremy · Jan 10, 2010 · Viewed 82.3k times · Source

I have a shared master page which I am using from 2 different areas in my mvc 2 app. The master page has an action link which currently specifies the controller and action, but of course the link doesn't work if I'm in the wrong area. I see no overload for actionlink that takes an area parameter, is it possible to do?

Answer

Jeremy picture Jeremy · Jan 10, 2010

Figured it out..

Html.ActionLink("Link Text", "ActionName", "ControllerName", new { Area = "AreaName" }, new{})