+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / System.InvalidOperationException: RegisterRequiresControlState can only be called before and during PreRender

System.InvalidOperationException: RegisterRequiresControlState can only be called before and during PreRender

3 posts, 0 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    08 Oct 2010
    Link to this post
    I am randomly getting the error below. I cannot reproduce it, but it looks like it only happens on the preview. I cannot tell if it is happening on the frontend because this particular error does not get logged for some reason (which may say something about where it is in the lifecycle). Wondering if anyone else is getting this?

    I am running v3.7 SP4 on .NET 4.0.

    Server Error in '/' Application.

    RegisterRequiresControlState can only be called before and during PreRender.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: RegisterRequiresControlState can only be called before and during PreRender.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: RegisterRequiresControlState can only be called before and during PreRender.]
       System.Web.UI.Page.RegisterRequiresControlState(Control control) +2768410
       System.Web.UI.Control.AddedControl(Control control, Int32 index) +8905460
       System.Web.UI.ControlCollection.Add(Control child) +79
       Telerik.Cms.Web.PreviewPage.CreateChildControls() +845
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
  2. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    08 Oct 2010
    Link to this post
    I found this Sitefinity blog about this error:

    This may only be happening in my case because the SQL server is not in the same network as this development server. So the latency may be the issue.
  3. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    13 Oct 2010
    Link to this post
    Hello bemara57,

    Thank you for getting back to us.

    The problem you have linked to is resolved. It was related to the Nolics data layer and the code mentioned in the blog post is already part of the Sitefinity code. Can you make some further investigation and see if this is manifested on certain pages only? Pages that have the same controls - custom or built in controls. You can try using ELMAH error logger to see if it will capture such problems. You can see instructions on how to set up Sitefinity with ELMAH here.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
3 posts, 0 answered