Html.Action - Not Enough ExecutionStackException

When I use @Html.Action("Index") , InsufficientExecutionStackException is a throw, why? this is a simple mvc command line.

+4
source share
1 answer

@Html.Action performs the specified action and returns the result of this action as a string.

If you re-execute the Index action, which then re-displays the same view, it is simply rounded and rounded.

If you want a link, use @Html.ActionLink("Index") instead.

Here is an example of this:

 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> 
+8
source

Source: https://habr.com/ru/post/1483564/


All Articles