Sitecore Preview.DefaultSite

Server Error in '/' Application.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

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.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

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:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +12540650 Sitecore.Layouts.PageContext.InsertUnusedControls() +285 (Object , Object[] ) +83 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365 Sitecore.Layouts.PageContext.BuildControlTree(Object sender, EventArgs e) +211 System.Web.UI.Page.PerformPreInit() +49 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1844



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

Solution:

Remove all <% in ascx file with Literals! Mostlty Literal that fill content from Code Behind will help you. Check first Default.aspx in the layouts folder of website root!

Comments