Recently, after a patch was applied to the web server, some of our larger, more intensive applications starting throwing the following fairly cryptic exception:

ERROR: System.Web.HttpException: The URL-encoded form data is not valid.
System.InvalidOperationException:  Operation is not valid due to the current state of the object.

This is due to an update (MS11-100) that was pushed out in December 2011 that allows a web form to accept a limit of 1,000 items.

The fix is easy, simply add an item to your web.config appSettings section.  The following example increases the number of items accepted by a web form from 1,000 to 9,999:

<appSettings>
  <add key=”aspnet:MaxHttpCollectionKeys” value=”9999″ />
</appSettings>

Advertisements