Is there a way to redirect to a specific action/controller on a different Area?
RedirectToAction between areas?
Asked Answered
Did you try this?:
return RedirectToAction("action", "controller", new { area = "area" });
I am not seeing this work when I go from an area back to the main app. Area=""?? –
Glendon
@MvcCMsJon
return RedirectToAction("action", "controller", new { area = "" });
should do it. –
Distinctive return RedirectToAction("Index", "Users", new { area = "Administration" });
is giving No route matches the supplied values.
–
Laryngitis 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 = "" });
Try this
return RedirectToAction("ActionName", "AreaName/ControllerName");
© 2022 - 2024 — McMap. All rights reserved.