SaaS CMS has officially launched! Learn more now.

Per Nilsson
Jan 18, 2012
  17214
(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
A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024