RenderAction stackoverflow

Topics: Troubleshooting, Writing modules
Aug 2, 2011 at 1:50 PM
Edited Aug 2, 2011 at 6:43 PM

When i place the following Html.RenderAction code in my Layout i get an stackoverflow!:

 Html.RenderAction("Register", "Account", new { area = "ExtendedUsers", mvcController = "Account", mvcAction = "Register" });

The Register action returns:

return new ShapeResult(this, shape);

Edit: I found out when i return return Content("Test");  i don't get a stackoverflow? bug?

Aug 2, 2011 at 10:30 PM

It's a bug alright... in your code :)

Seriously, your action is returning a shape result, that will get dressed up by the current theme when it gets executed, which will render layout, which will call RenderAction, which... you get the idea.

You may want to fator this into an action that returns a different type of result, or you might want to reconsider usingRenderAction altogether. What is your scenario exactly?

Aug 3, 2011 at 10:10 AM
Edited Aug 4, 2011 at 7:38 AM

Thanks. Just before just reacted i found it out :) I've return now a partialview. Well i think this is the best solution for my scenario (see Because i don't like to create a widget and hide and show it as popup ala lightbox. I think it is nicer to do this with a RenderAction. Don't you think?