I have this error:
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
with inner exception:
Child actions are not allowed to perform redirect actions.
Any idea why this happening?
Incidentally, the error is happening on this line:
@Html.Action("Menu", "Navigation")
The Menu Action in the Navigation Controller looks like this:
public ActionResult Menu()
{
return PartialView();
}
Instead of @Html
use @Url
.
Before: @Html.Action("Menu", "Navigation")
After: @Url.Action("Menu", "Navigation")
This is not allowed because MVC has already started Rendering the View to the browser (client). So the MVC Frameworks blocks this, because the client already receives data (html). As long as the rendering is in progress you not able to redirect in your child view.
You can return RedirectToAction
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With