ThrowIfMaxHttpCollectionKeysExceeded Exception
In an asp.net application having an HTML form in which a user has option to select objects (e.g in a salesforce data transfer utility a user has the option to select salesforce objects to transfer data from production to sandbox) by using check boxes to send data to the server through post. Asp.net would throw an exception if Max Keys (Objects in our case) exceeds 1000. See below for exception details
System.Web.HttpException: The URL-encoded form data is not valid. ---> System.InvalidOperationException: Operation is
not valid due to the current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()
In order to prevent this from happening web.config needs some adjustment. Microsoft has restricted this no. to 1000 to prevent DOS attacks
Solution is to increase this limit to 2000, see below
<code><appsettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2000"></add>
</appsettings></code>