I'm getting this error when I try to populate a webpart,

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() Troubleshoot issues with Windows SharePoint Services.

Note that, I populated other webparts before as well but now none of webpart is actually getting populated to the SharePoint webpart gallery.

I did read solution for wniforms, but will it be the issue as the webpart that used to populate before are not even populating now.

  <add key="aspnet:MaxHttpCollectionKeys" value="1001" />
  • What version of SharePoint? – John Chapman Jan 12 '12 at 21:26
  • @John its SharePoint 2007 – Muhammad Raja Jan 13 '12 at 9:00

This is caused by a recent security update by Microsoft. By default the size of the Forms collection is now 1000 items.

You can find more about this and a workaround at this URL:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.