Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html.Action - InsufficientExecutionStackException

When i use @Html.Action("Index") the InsufficientExecutionStackException is throw, why? it's a simple mvc command line.

like image 262
Jean Toledo Avatar asked May 30 '13 12:05

Jean Toledo


1 Answers

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>
like image 124
Dominic Zukiewicz Avatar answered Oct 21 '22 00:10

Dominic Zukiewicz