Thursday, August 7, 2014

How to link to a root controller from area controller in MVC

Sometimes you need to call a root controller from inside of an area, usually when you are inside of an Admin console for example.
The process is really simple, all you have to do is specify the area as blank in the RenderAction or the RedirectToAction functions.



        <% Html.RenderAction("Action", "Controller", new { area = "" }); %>


        public ActionResult redirect()
        {
            return RedirectToAction("Action", "Controller", new { area = "" });

            return RedirectToAction("Action", "Controller", new { area = "", id = 5 });

        }


No comments:

Post a Comment