Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 07, 2012 05:16 AM by anilmaddala
Dec 30, 2011 10:44 PM|LINK
I have some code running as a Web Application on an IIS 7/Server 2008 box written in VB that has been fine for years, suddenly it's blowing up with an exception I've never heard of before:
I did a google search on ThrowIfMaxHttpCollectionKeysExceeded and it returned a single hit, a post on social.technet.microsoft.com's Korean site, posted less than 24 hours ago. Address of that post:
Contents (translated from Korean):
I'm using ASP.NET 2.0
Windows Server 2003 and Windows XP x86 Microsoft. NET Framework 2.0 SP2 Security Update for (KB2656352)
Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008 x86 on the Microsoft. NET Framework 3.5 SP1 Security Update for (KB2657424)
Windows Server 2003 and Windows Server 2003 R2 x86 Microsoft. NET Framework 1.1 SP1 Security Update for (KB2656358)
I headed to patch an existing site after issuing an error bout Is it any problem?
Server Error in '/' Application has
Because of the current state of the object, the operation is not valid
description: during the execution of the current web request an unhandled exception has occurred. Review the stack trace the error and where it originated in the code can find more information about the location.
Exception Details: System.InvalidOperationException: Because of the current state of the object, the operation is not valid.
During the execution of the current web request an unhandled exception was generated. Using the exception stack trace below information regarding the origin and location of the exception can be found.
[InvalidOperationException: object's current state is not valid because the job.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded () +2692302
System.Web.HttpValueCollection.FillFromEncodedBytes (Byte  bytes, Encoding encoding) +61
System.Web.HttpRequest. FillInFormCollection () +148
[HttpException (0x80004005): URL-encoded form data is invalid.]
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
Version Information: Microsoft. NET Framework version: 2.0.50727.3625; ASP.NET Version: 2.0. 50727.3634
These errors do not smell.
I applied updates to my server last night. To me, these errors DO smell.
Anybody else seeing anything fishy with their .Net 2.0 Asp.Net code as of the new updates?
Dec 31, 2011 12:06 AM|LINK
Please read this as it likely relates to your error:
How many form fields did you expect to be posted from your page that threw the error?
Dec 31, 2011 12:15 AM|LINK
note that the default number of fields posted may be limited to 1000 if you have installed the latest patch.
Jan 11, 2012 06:15 PM|LINK
I face similar issues in one of my applications. Did you find any solution for this issue yet? Thanks.
Jan 11, 2012 06:29 PM|LINK
If the stack trace contains this:
Then somebody posted quite a few form fields to your page. The new default max introduced by the recent security update is 1000.
If you were expecting more than 1000 values to be posted, then you can alter that max to allow more. Please read through that link i had previously posted: http://stackoverflow.com/questions/8684049/asp-net-ms11-100-how-can-i-change-the-limit-on-the-maximum-number-of-posted-for
Jan 11, 2012 07:23 PM|LINK
Thanks mbanavige, adding the below element in the web.config fixed the issue.
<appSettings> <add key="aspnet:MaxHttpCollectionKeys" value="2001" /> </appSettings>
Jan 12, 2012 08:15 PM|LINK
I have added the setting, but still am getting the error. I set mine to 10000, but still does not seem to help. I have an application that is completely dynamic for the number of items that show, basically it is a workflow and all items that need to process
show on the page. The user will check off those that should move to the next phase. I use a number of hidden fields to keep the data I need when it submits without having to call the database again. This is a horrible feature. I am now possibly going to have
to rewrite the application, but it just went live for my customer. What is the deal MSFT????
Jan 12, 2012 08:45 PM|LINK
I have added the setting, but still am getting the error. I set mine to 10000, but still does not seem to help
How may form inputs are you posting when you receive the error?
Jan 12, 2012 08:54 PM|LINK
I have a listview and it may have several hundred items, actually there is a nested listview in a listview to have a parent child details. Each of the line item details may be checked off to note it has been processed. So it is completely dynamic. In my
error logging, seems the actual number of bytes is not being logged, so I will enhance that. If I have 200 orders and estimated at 5 items per order, then that would be what posts, however I do have a number of hidden fields per. So lets say 10, so I come
up with 10000 for the number, which others are saying 2001 helps them.
This app is actually ASP.Net 4.0 not 2.0, so if that matters.
Jan 13, 2012 12:22 AM|LINK
I have a dev machine I can point to the production SQL and found the page giving me fits has 1234 form elements posted back. I found my development server did not have the patch, so I will apply it and see if I can rework the pages to not use the hidden
form elements and just query SQL for the data I need each time (seems more chatty, than look up once and pass it around).