Stackoverflow Exceptions with Html.Action
Posted by: K. Scott Allen,
on 09 Feb 2011 |
View original | Bookmarked: 0 time(s)
If you ever have a stack overflow using Html.Action or Html.RenderAction in a Layout view, then check the return type of your child action. public class Weather : Controller
{
public ActionResult Forecast()
{
// ...
return View();
}
}
The problem is if you call that action from a Layout view, like so:
@Html.Action(actionName: "Forecast",
controllerName: "Weather")
... then the child action is returning a ViewResult (which will pick up a Layout from...