Server Error in '/' Application.
________________________________________
Operation is not valid due to the current state of the object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpRequest.FillInFormCollection() +11091695
System.Web.HttpRequest.get_Form() +119
System.Web.HttpRequest.get_HasForm() +11085399
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124
System.Web.UI.Page.DeterminePostBackMode() +83
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270
________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634
Reasons:
You installed the Windows Update recently: Microsoft Security Bulletin MS11-100.
The bulletin fixes the DOS attack vector by providing a limit to the number of variables that can be submitted for a single HTTP POST request. The default limit is 500.
Resolution:
This problem can be resolved in two ways:
- Reconfiguring Image Uploader and server-side script to send all files in upload list into multiple packages (FilesPerPackage property should be set to some small value (e.g. 1-10))*.
- Modifying applicationHost.config file. Go to C:\Windows\System32\inetsrv\config\applicationHost.config and add the following section to the config file, like it is shown in this code:
Code:123<appSettings><addkey="aspnet:MaxHttpCollectionKeys"value="10000"/></appSettings>
It will allow increasing the number of variables that can be sent in a single HTTP POST request.
________
* - The second way still has limitation. If you send all files in a single request, number of variables posted in a request depends on number of files. This way, increasing the value in config will give a temporary solution. Anyway it can be found amount of files causing this exception again. To eliminate even a chance of this problem you need to consider the first way.
Add This key in Web.config file.
added this key to the <appsettings> and it fixed the problem.
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="10000" />
</appSettings>