Jonathan
Jonathan

Reputation: 32868

Can I use RedirectToAction to navigate from one area to another?

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

Upvotes: 167

Views: 99929

Answers (3)

Suhani Mody
Suhani Mody

Reputation: 691

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 = "" });

Upvotes: 57

Abdulla Sirajudeen
Abdulla Sirajudeen

Reputation: 1331

Try this

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

Upvotes: 3

eu-ge-ne
eu-ge-ne

Reputation: 28153

Did you try this?:

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

Upvotes: 320

Related Questions