Monday, April 23, 2012

Operation is not valid due to the current state of the object, Exception in ASP.NET

I got this error when I tried to save a Page with lots of form fields to SQL Server Database.
The default max number of form fields that can be post is 1000.
In order to solve this error add this Line to your Web.Config File:

<appSettings>
  <add key="aspnet:MaxHttpCollectionKeys" value="10000" />
</appSettings>