Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RedirectToAction between areas?

People also ask

What is difference between RedirectToAction and RedirectToRoute?

RedirectToAction will return a http 302 response to the browser and then browser will make GET request to specified action. Show activity on this post. Ideally I would use RedirectToRoute for Action Links/Images and RedirectToAction in Controller's Action to redirect to another Controller's Action .

Can we pass model in RedirectToAction?

By including a NuGet package called MvcContrib you can easily pass model or form data through a simple RedirectToAction function call inside of your controllers. The data will then be handled in the other view and be strongly typed to the model you are passing through the redirect.

Which code statement is used to redirect to a controller action in a different area?

RedirectToAction(String, String) Redirects to the specified action using the action name and controller name.


Did you try this?:

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

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