Ajax Error Message:The state information is invalid for this page and might be corrupted

The message is shown when a page with partial postback regions (update panels) is refreshed by F5 or browser's refresh button and then a new partial postback request is performed. In this case the information stored in the page has been changed and causes not to be possible to perform partial postback. For pages like these the page parameter EnableEventValidation must be set to false:

<%@ Page EnableEventValidation="false" ....

Another case is described here: http://support.microsoft.com/kb/323744

6 comments:

  1. Thanks for this post
    Help to understand the cause of the problem.

    What role plays EnableEventValidation ?

    ReplyDelete
  2. EnableEventValidation is a very good feature of asp.net. Without any your efforts asp.net checks (validates) the postbacks. This can prevent hackers attacks and request manipulation. The actual function if that feature is to register all components which cause postback and then check their authenticity during requests (postbacks). That is whay is not very good to turn that feture off. In such cases I recommend you to be sure the postbacks cannot harm your data.
    You can do manually registering of the controls for validation by
    Page.ClientScript.RegisterForEventValidation(this.UniqueId)
    Consider well if you really can leave the page without that check up. :)

    ReplyDelete
  3. Thanks again for explaining.
    so if EnableEventValidation is false, and I do want to be on the safe side, you suggests using the
    RegisterForEventValidation, but wouldn't it be the same effect and the error "the satate infor is invalid....." will pop again ?

    ReplyDelete
  4. With RegisterForEventValidation you can choose the control which you want to be safe for events. You can disable event validation as a whole but enable for some of the controls on your page.
    Please don't post only anonymous comments. Write your name below the comment. It's good to know who I am speaking to.

    ReplyDelete
  5. Ok thanks , understood what you explained.

    you have a nice blog, and I have put it in my fast favorite links.
    very informative.

    So I'm Ronen From Israel
    nice to meet.

    ReplyDelete
  6. nice to meet you too..., I am from Bulgaria

    ReplyDelete