|Number of votes:||4|
Got a ticket to the support with an error I haven't seen before and found out that the reason is a two weeks old Microsoft hotfix. It might happen to someone else so wanted to write a few rows how to solve it if you run into the problem.
During the holidays MS published the security update MS11-100. This update has been released to fix ASP.NET DoS vulnerability and limits the amount of parameters for a single HTTP POST to 1000. It's probably not that often you use more than 1000 parameters but this is the error you will end up with if you do (the one to look for is ThrowIfMaxHttpCollectionKeysExceeded):
Operation is not valid due to the current state of the object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte bytes, Encoding encoding) +61
[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133
When they added the limitation of parameters they also added the possiblilty to override the default value by a new setting in web.config. Can also mention that it’s not possible to apply different values at different locations.
Add the following setting to web.config with a value larger than 1000 (default):
<add key="aspnet:MaxHttpCollectionKeys" value="some number here"/>
The above setting should fix the problem.
Info about the hotfix and people getting the error in the discussion following the article:
The same error discussed in a forum