RedirectToAction between areas?

asp.net Mvcasp.net Mvc-AreasRedirecttoaction

asp.net Mvc Problem Overview


Is there a way to redirect to a specific action/controller on a different Area?

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

Did you try this?:

return RedirectToAction("action", "controller", new { area = "area" });

Solution 2 - asp.net Mvc

Your answer was helpful to me. Just wanted to add below:

If you want to redirect from one area to another area, above code works well.

And, if you want to redirect from one area to a controller/view which is not there in the area folder (i.e. in most cases, your front end), you can specify area = "".

i.e.

return RedirectToAction("action", "controller", new { area = "" });

Solution 3 - asp.net Mvc

Try this

return RedirectToAction("ActionName", "AreaName/ControllerName");

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonathanView Question on Stackoverflow
Solution 1 - asp.net Mvceu-ge-neView Answer on Stackoverflow
Solution 2 - asp.net MvcSuhani ModyView Answer on Stackoverflow
Solution 3 - asp.net MvcAbdulla SirajudeenView Answer on Stackoverflow