Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Failed to load viewstate warning - Asp.Net Web Forms app

Posted on 2014-10-10
3
Medium Priority
?
444 Views
Last Modified: 2014-11-10
Hello,

I have an Asp.Net web forms application (4.5) that works fine but the event log on the IIS server is riddled with warning level entries about "Failed to load viewstate." (full message below).  My research indicates this can happen when dynamically adding controls improperly, but I have no dynamically added controls.  I do user web user controls, and I do use a master page.  The master page has a RadWindow (Telerik) which has a web user control inside of it's content template.  Also some of the other pages have web user controls.

Any ideas?  Thanks a lot.

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10/10/2014 8:06:21 AM
Event time (UTC): 10/10/2014 12:06:21 PM
Event ID: 95721625fd21464789c949a0a448323e
Event sequence: 4468
Event occurrence: 549
Event detail code: 0
 
Application information:
    Application domain: /LM/W3SVC/2/ROOT/*******-1-130573917227018547
    Trust level: Full
    Application Virtual Path: /*******
    Application Path: D:\Websites\Intranet\*******\
    Machine name: *******19
 
Process information:
    Process ID: 11120
    Process name: w3wp.exe
    Account name: IIS APPPOOL\Intranet
 
Exception information:
    Exception type: HttpException
    Exception message: 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.
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Page.LoadAllState()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 
 
Request information:
    Request URL: http://intranet.*******.com/*******/Default.aspx 
    Request path: /*******/Default.aspx
    User host address: 172.16.1.52
    User: *******\RobB
    Is authenticated: True
    Authentication Type: Negotiate
    Thread account name: IIS APPPOOL\Intranet
 
Thread information:
    Thread ID: 16
    Thread account name: IIS APPPOOL\Intranet
    Is impersonating: False
    Stack trace:    at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
   at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
   at System.Web.UI.Page.LoadAllState()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 
 
Custom event details:
0
Comment
Question by:Martin Bertram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 40374251
Hard to say without looking at your code, Some guidelines:
- Identify which control may have changed contents between requests that is triggering the issue. You may try by deleting all controls and then add one control at the time until the error happens.
- Check if you really need View state for the control found in previous step. If not needed set EnableViewState to false.

Please post sample code if more help needed.
0
 

Author Comment

by:Martin Bertram
ID: 40406222
I suspect that it is occuring because I republished a new version of the application and users haven't closed the application on their browser.   Is there a way to catch this exception in the code and then perhaps force a redirect to the same page to reload it, or something to that effect?
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 40407473
If that is the case, you are better off asking the users to logoff and restart server IIS.
Also the users must delete any temporary browser files to avoid any cached file being loaded instead of your new files.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question