I have an MVC 4 view where I render the following actions
@{
Html.RenderAction("Index", "Logo");
Html.RenderAction("Index", "MainMenu");
}
I have a form on my view which is filled out and posted to the controller. In the controller I perform some tasks and then send the model back to my view
[HttpPost]
public ActionResult Index(ManageAdministratorModel manageAdministratorModel)
{
// I save some of the fields to the database here.
return View(manageAdministratorModel);
}
When I'm redirected to the view I receive the following error
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
on this line
Html.RenderAction("Index", "Logo");
Any idea why this is happening?
Get rid of the layout
@{ Layout = null; }
in the child view.I got this error, but my problem was diferent. To see what is the error about, involve the line you get the error inside a try catch code, like this:
Execute it with a break point at throw line and check the inner exception of the 'e'. My problem was that I'd changed the parameter name on my Controller and forgot to change it on my View.
It's easier to get the error using try catch.
Replace:
with:
otherwise you might be ending in an infinite loop because you are rendering a view which is attempting to render a view which is attempting to render a view, ...
Also you might need to remove the
[HttpPost]
attribute from your child action.I had exactly the same problem, and because I was using attribute routing, the inner exception error message was:
Remove the [HttpGet] attributes from action methods called by Html.Action() and it works. Nothing to do with routing.
I had this problem, It could happen because render engine can't find any view (corresponding to the name that is given in acton) I'd given wrong name of view (I mistakenly had given action name instead of view name) when I return view name and view model using
PartialView()
method, I corrected my view name and it worked fine