‘Operation is not valid due to the current state of the object’ error during postback


System.InvalidOperationException: Operation is not valid due to the current state of the object.

[InvalidOperationException: Operation is not valid due to the current state of the object.]    System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +11372207    System.Web.HttpRequest.FillInFormCollection() +329

[HttpException (0x80004005): The URL-encoded form data is not valid.]    System.Web.HttpRequest.FillInFormCollection() +11486290    System.Web.HttpRequest.get_Form() +157    System.Web.HttpRequest.get_HasForm() +11487092    System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +141    System.Web.UI.Page.DeterminePostBackMode() +100    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500


  <add key="aspnet:MaxHttpCollectionKeys" value="1001" />

Microsoft recently (12-29-2011) released an update to address several serious security vulnerabilities in the .NET Framework. One of the fixes introduced by MS11-100 temporarily mitigates a potential DoS attack involving hash table collisions. It appears this fix breaks pages that contain a lot of POST data. In our case, on pages that have very large checkbox lists. Why would this be the case?

Some non-official sources seem to indicate that MS11-100 places a limit of 500 on postback items. I can’t find a Microsoft source that confirms this. I know that View State and other framework features eat up some of this limit.

source: http://stackoverflow.com/questions/8684049/asp-net-ms11-100-how-can-i-change-the-limit-on-the-maximum-number-of-posted-for

Alternative reading: http://www.webreference.com/programming/asp/ASPNet-Exception-Handling/index.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s