Root Cause:
Typically this happens when AJAX controls are involved (Microsoft’s UpdatePanel or others that utilize AJAX POST requests.)
Solution:
Go to this path in SharePoint server.
C:\inetpub\wwwroot\wss\VirtualDirectories\80
Open web.config
Add below tags inside <appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2000" /">
<add key="aspnet:MaxJsonDeserializerMembers" value="2000" /">
Another important change, which i did...
I was migrating MOSS 2007 to SP 2010.
I was using old custom webpart, which is having a class file.
It is referring
public class MyCustomClassWebPart : WebPart
I changed above line to:
public class EditFormWebPart : Microsoft.SharePoint.WebPartPages.WebPart
Still if you get same error, then don't press F5 or Ctrl+F5 from your Visual Studio.
Right click on project -->Select Retract,
Then right click on project-->Select Deploy.
If you press F5 or Ctrl +F5, you will get error...
It solved my problem.