When i use @Html.Action("Index")
the InsufficientExecutionStackException
is throw, why? it's a simple mvc command line.
The @Html.Action
is executing the action specified and returning the result of that action as a string.
If you are re-rendering the Index
action that then re-renders this same view, its just going round and round and round.
If you want a link, use @Html.ActionLink("Index")
instead.
Here is an example of this occurring:
public class HomeController : Controller
{
public ViewResult Index()
{
return View();
}
}
And this is the Razor code:
<html>
<head>
<title>Index</title>
</head>
<body>
<!-- Causes an infinite loop; embedding the same action inside itself -->
@Html.Action("Index")
</body>
</html>
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