|Number of votes:||2|
Recently I was involved investigating a rather peculiar bug. Since there have been several related forum posts on World, and also in the support system, I thought I should give a quick “heads up”.
The bug itself behaves in the following manner:
Creating a new page from edit mode (by using “Save and Publish” or “Save and View”) and then selecting “Edit”, causes a runtime error:
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
The error only occurred when publishing page types with a property of type XForm, and were regardless of page type implementation (not related to the .aspx code).
After hours of scratching my head searching for the cause of this, I found the source of the problem:
An external module had a EditPanel plugin that where adding a CSS file to the Page’s header collection in Page Load.
Use the Plugin-Manager in admin mode to find EditPanel plugins, and try disabling each to find “the bad guy”.
This error typically occur on page types using XForms because the XForms property is using viewstate.
Note: The error seem to be limited to EPiServer CMS 5 (SP2) – the same code runs without errors in CMS 6.