1

I need to redirect to root controller action method from an area controller in Asp.Net Core MVC application. I'm trying to use

return RedirectToAction("Actionname","ControllerName",modelObject)

But this is trying to locate the controller in the area itself, which is not present and I'm getting a 404 error. How to resolve this?

1 Answers1

0

Try like below.

return RedirectToAction("Actionname", "ControllerName", new { area = "" });

Also you can not pass modelObject to RedirectToAction as per the ControllerBase.RedirectToAction Method documentation

Karan
  • 12,059
  • 3
  • 24
  • 40
  • what if i need to send the model object? – Toruk makto Aug 05 '20 at 05:32
  • https://stackoverflow.com/a/11209320/9695286 This answer can help your to pass model. Though it is asked for `asp.net mvc` but it also covers `Using TempData to pass model data to a redirect request in Asp.Net Core`. – Karan Aug 05 '20 at 05:38