Per Nilsson
Jan 18, 2012
  17284
(4 votes)

MS Update MS11-100 breaks sites with more than 1000 parameters

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.

Source Error:

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.

Stack Trace:
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
System.Web.HttpRequest.FillInFormCollection() +148

[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +206
System.Web.HttpRequest.get_Form() +68
System.Web.HttpRequest.get_HasForm() +8735447
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
System.Web.UI.Page.DeterminePostBackMode() +63
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133

 

Solution:
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):

<appSettings>
   <add key="aspnet:MaxHttpCollectionKeys" value="some number here"/>
</appSettings>

The above setting should fix the problem.

 

Links:
Info about the hotfix and people getting the error in the discussion following the article:
http://weblogs.asp.net/scottgu/archive/2011/12/28/asp-net-security-update-shipping-thursday-dec-29th.aspx

The same error discussed in a forum
http://forums.asp.net/t/1754522.aspx/1?New+Net+2+0+Bug+From+Windows+Update+

Jan 18, 2012

Comments

Please login to comment.
Latest blogs
Integrating Optimizely DAM with Your Website

This article is the second in a series about integrating Optimizely DAM with websites. It discusses how to install the necessary package and code t...

Andrew Markham | Sep 28, 2024 | Syndicated blog

Opticon 2024 - highlights

I went to Opticon in Stockholm and here are my brief highlights based on the demos, presentations and roadmaps  Optimizely CMS SaaS will start to...

Daniel Ovaska | Sep 27, 2024

Required fields support in Optimizely Graph

It's been possible to have "required" properties (value must be entered) in the CMS for a long time. The required metadata haven't been reflected i...

Jonas Bergqvist | Sep 25, 2024

How to write a bespoke notification management system

Websites can be the perfect vehicle for notifying customers of important information quickly, whether it’s the latest offer, an operational message...

Nicole Drath | Sep 25, 2024