Wednesday, 11 April 2012

Error - System.InvalidOperationExceptionOperation is not valid due tothe current state of the object

Please note there was a recent microsoft security update that changed the default limit of form fields on pages to 1000. If a page exceeds this amount, you are likely to see below error:

System.InvalidOperationExceptionOperation is not valid due to the current state of the object.

Adding the below setting to the web-config file overcomes this limitation,  in this example it is increased to 2000.

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

More information can be found at:

http://stackoverflow.com/questions/8832470/operation-is-not-valid-due-to-the-current-state-of-the-object-error-during-pos
Note: This setting has been added to the default web.config file, but for upgrades we don't replace the web.config file so it will have to be added manually.

No comments:

Post a Comment