Asp.Net Viewstate verification failed RRS feed

  • Question

  • User-924931093 posted

    Here is the issue description: I have a web-farm [load balanced] servers, and I had an ASP.Net web-forms site running without any issue at all! and recently without any change I started getting this error:

    Event code: 4009 
    Event message: Viewstate verification failed. Reason: Viewstate was invalid. 
    Event time: 3/5/2019 1:24:31 AM 
    Event time (UTC): 3/5/2019 6:24:31 AM 
    Event ID: 40c56ea2a8ad4c059357fc4673003bbf 
    Event sequence: 359 
    Event occurrence: 1 
    Event detail code: 50204 

    I searched/read most of the Stack-overflow's threads and worked on making sure that all is in place as recommended also by Microsoft

    What I tried so far, maybe this could help someone else with this issue:

    • Checked the viewstate in both servers and they're identical and not set to be autogenerated.
    • Tried storing the viewstate in the session using this code:
    protected override object LoadPageStateFromPersistenceMedium()
                return Session["_ViewState"];
        protected override void SavePageStateToPersistenceMedium(object viewState)
            Session["_ViewState"] = viewState;
    • I tried to set maxPageStateFieldLength="128" in the web.config file and this cause this error:
    Error Message: Invalid viewstate: Missing field: __VIEWSTATE2414.
    Stack Trace: 
    at System.Web.UI.Page.get_RequestViewStateString()
    • Extending the Idle Time-out property in the App Pool linked to the site in the IIS to 24 hrs. instead of 20 minutes
    • I read this article

    • I have ANTI_CSRF in the Master Page and this was before having the viewState issue - I double checked that it is not causing this issue at all.

    The bottom line is that I'm still getting the viewState invalid exception, but hope this list could help the others.

    Tuesday, March 5, 2019 8:22 PM

All replies