I have a webpage that posts multiple form tags. It's an inline edit page, where I can either post one row at a time or multiple rows. Last night, without making any changes to the code or data, I started getting The URL-encoded form data is not valid
error on multiple posts, although single row posts work fine.
Asked
Active
Viewed 3.7k times
68

Pops
- 30,199
- 37
- 136
- 151

Paul Kogan
- 681
- 1
- 5
- 3
-
3Code and exception details please. We need more information. Read this: https://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx – Oded Jan 11 '12 at 18:01
-
I'm afraid we'll need to see some code to get the context – Claudio Redi Jan 11 '12 at 18:02
2 Answers
111
The MS KB issue in question is: http://weblogs.asp.net/scottgu/archive/2011/12/28/asp-net-security-update-shipping-thursday-dec-29th.aspx
In a nutshell there is now an upper bound on the number of simultaneous HTTP form elements that may be posted. The default is now 1000 without explicitly changing it with this key in the <appSettings>
portion of the web.config:
<add key="aspnet:MaxHttpCollectionKeys" value="some number greater than 1000" />

Greg Lary
- 1,171
- 1
- 7
- 4
-
1we started getting this on a asp.net MVC site. added the above config entry to our web.config file with a setting of 9000 and bam it was fixed. Thx. – Blake Mills Jun 15 '12 at 18:36
-
2+1 I was afraid this strange problem was going to kill my thursday, no it didn't. – daniloquio Jul 19 '12 at 14:15
-
wow, i had this issue last week and i ended up submitting my data in chunks because i couldn't find a solution. was googling something else and came across this. good to know! – rbedger Sep 11 '14 at 11:42
-
This fixes issue "The URL-encoded form data is not valid. Operation is not valid due to the current state of the object." with SSRS (SQL Server 2008R2). – Nilesh Thakkar May 18 '18 at 09:09
15
There was a microsoft update and it may have caused your issue see link. http://knowledgebase.solarwinds.com/kb/questions/3476/Website+Error%3A+The+URL-encoded+form+data+is+not+valid

1234
- 167
- 2
-
thank you very much for your help! it looks like the problem by all the symptoms but increasing the value of
in the web.config did not help – Paul Kogan Jan 11 '12 at 22:31 -
1
-
8Most will know this, but the key above goes in the "
" section of the web.config. – Solburn Jan 24 '12 at 20:20 -
Thank you so much, I was really confused why one of my web apps stopped working with this unhelpful message. – Rachel Feb 03 '12 at 19:13
-
1Important note to remember: hidden fields are going to count towards the items in the collection. Allocate accordingly. – Jonathan Bates Feb 10 '12 at 04:44
-
Worked for me, had to change mine to 2000. Also probably should note that this is a good temporary solution, we will be redoing our asp.net page that caused this problem so that we can remove this setting later. – Frank May 30 '12 at 21:31
-
5All of these comments and the other answer are extremely helpful. However, this answer is just a simple link to a website, which is really useless (particuarly if that website goes down). -1 – Richard Jun 07 '12 at 19:03