• Home
  • About
  • Resume

Solution for “Operation is not valid due to the current state of the object” error

By , 06/04/2012 12:24 PM

Typically this happens when AJAX controls are involved (Microsoft’s UpdatePanel or others that utilize AJAX POST requests.) The error may be displayed outright or, if nothing is shown on the UI – logged in the Event Viewer. In any case you will get a message similar to:

0x800a139e – Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Operation is not valid due to the current state of the object

Issue happens because Microsoft Security Update MS11-100 limits number of keys in Forms collection during HTTP POST request. To alleviate this problem you need to increase that number.

This can be done in your application Web.Config in <appSettings> section (create the section directly under <configuration> if it doesn’t exist. Add 2 lines similar to the lines below to the <appSettings> section:

<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
<add key="aspnet:MaxJsonDeserializerMembers" value="2000" />

The above example set the limit to 2000 keys. This will lift the limitation and the error should go away.

6 Responses to “Solution for “Operation is not valid due to the current state of the object” error”

  1. Amir says:

    Thanks very much!!! It was a headache trying to figure out the cause of the error!!

  2. vivek says:

    not working at all. Redirecting subreport from main SSRS report.

  3. Yuriy says:

    @vivek: Could you elaborate please?

  4. dhina says:

    really it help for me thank you very much…….

  5. gary says:

    Very helpful, thank you!

  6. Mark says:

    thank you very much, it helped me a lot!

Leave a Reply

Panorama Theme by Themocracy