Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Mari Jørgensen
Jun 14, 2011
  5672
(2 votes)

Failed to load viewstate

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”.

How the bug manifests itself

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.

Failed to load ViewState

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).

What to look for

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.

How to solve it

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.

Jun 14, 2011

Comments

Erik Aandahl
Erik Aandahl Apr 16, 2012 02:55 PM

Thanks Mari.
I ran into the same problem in CMS6. Had an EditPanelPlugin that added a property to ViewState. In my case it (seems to) work just as well with Session

Please login to comment.
Latest blogs
Find and delete non used media and blocks

On my new quest to play around with Blazor and MudBlazor I'm going back memory lane and porting some previously plugins. So this time up is my plug...

Per Nergård (MVP) | Jan 21, 2025

Optimizely Content Graph on mobile application

CG everywhere! I pull schema from our default index https://cg.optimizely.com/app/graphiql?auth=eBrGunULiC5TziTCtiOLEmov2LijBf30obh0KmhcBlyTktGZ in...

Cuong Nguyen Dinh | Jan 20, 2025

Image Analyzer with AI Assistant for Optimizely

The Smart Image Analyzer is a new feature in the Epicweb AI Assistant for Optimizely CMS that automates the management of image metadata, such as...

Luc Gosso (MVP) | Jan 16, 2025 | Syndicated blog

How to: create Decimal metafield with custom precision

If you are using catalog system, the way of creating metafields are easy – in fact, you can forget about “metafields”, all you should be using is t...

Quan Mai | Jan 16, 2025 | Syndicated blog