Geeks With Blogs

News

Renso Hollhumer
Issue:

System.InvalidOperationExceptionOperation is not valid due to the current state of the object.

System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at System.Web.HttpRequest.FillInFormCollection()
   at System.Web.HttpRequest.get_Form()
   at Rhino.Commons.LongConversationManager.LoadConversationFromRequest(Boolean& privateConversation)
   at Rhino.Commons.LongConversationManager.LoadConversation()
   at Rhino.Commons.HttpModules.UnitOfWorkApplication.UnitOfWorkApplication_BeginRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
		
Cause:

Microsoft recently (12-29-2011) released an update to address several serious security vulnerabilities in the .NET Framework. MS11-100 was introduced just recently that handles potential DoS attacks.

Unfortunately the fix has also broken page POSTs with very large amounts of posted data (form fields). MS11-100 places a limit of 500 on postback items. The new default max introduced by the recent security update is 1000.

Adding the setting key to the web-config file overcomes this limitation, as in this example increases it to 2000.

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

Posted on Thursday, January 19, 2012 12:27 PM | Back to top


Comments on this post: Operation is not valid due to the current state of the object.

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you for this post. It solved a problem I had no ideas for.
Left by Mike Steigerwald on Jan 20, 2012 3:44 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Yup It works for me! Great
Left by Raship on Jan 25, 2012 1:17 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
I increase this to 4000 only then it was fixed.
Left by Sarit Shamay on Jan 26, 2012 3:35 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Yes, it works, thank you.
Left by Monte on Jan 26, 2012 4:44 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Yes, it works, thank you.
Left by Monte on Jan 26, 2012 4:44 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you :-)
Left by Jessy on Jan 27, 2012 10:10 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you :-)
Left by Jessy on Jan 27, 2012 10:11 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Good Deal, saved my bacon
Left by Rob on Jan 27, 2012 5:12 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Good Deal, saved my bacon
Left by Rob on Jan 27, 2012 5:12 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Wow, thank you so much! This helped solve my issue, one of my aspx pages, where the I had lot of form fields inside a repeater.
Left by Irf on Jan 29, 2012 4:59 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
But It didnt help since my website is in .framework 1.1. kinldy suggest a solution to resolve this.
Left by hrshdk on Jan 30, 2012 6:28 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
thanks a lot ......only when i raised it to 4000
it got fixed..
Left by ashwin on Jan 30, 2012 6:59 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks a lot...
Left by Alok Raj on Feb 06, 2012 1:51 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks!!! The suggestion solved my problem.
Left by Rajiv on Feb 10, 2012 5:35 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you !!!!
Left by Jess Alfredsen on Feb 24, 2012 5:14 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you !!!
Left by Jess Alfredsen on Feb 24, 2012 5:15 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you !!!
Left by Jess Alfredsen on Feb 24, 2012 5:15 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks for the info. I'm using the Telrik MVC Grid and it stores data as json in some instances. When using client side sort handling this would be a big issue for large tables. You think they would have found a better way ...
Left by Greg Gamble on Feb 28, 2012 1:20 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you very much. it works fine now.
Left by Anushka on Mar 07, 2012 11:59 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks! This worked perfectly. Was struggling to figure out why this would work on certain sets of data on the same page...now I know. Life saver!
Left by Mark Douglass on Mar 14, 2012 1:19 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Great, it worked for me. I had no clue about this.
Thank you.
Left by Manjula Ramanujam on Mar 21, 2012 1:21 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank u very much ............... It solved my problem. Thanks once again
Left by Kamalpreet Litt on Mar 23, 2012 11:43 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Where in the web.config file is that supposed to go?
Left by will on Apr 04, 2012 9:25 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank YOU!!!
Last night I posted an update to my web site and this morning I was greeted by my boss telling be that the web application crashed when changing dates in an ASPxGridView. I had no idea why because the error has nothing to do with what I was working on. The I googled and found this. When added the key with 2000 it worked again. THANK YOU AGAIN for posting the solution to this error!!!
Left by Hugo on Apr 12, 2012 8:23 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
It fixed the problem I was having loading a data
Left by Ana on Apr 19, 2012 6:14 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks buddy
Left by Sid on Apr 26, 2012 4:12 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
thanks mate. save me a good time going up and down trying to find a solution...
Left by Shah on Apr 30, 2012 7:16 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
You rule! How seemingly arbitrary and capricious of them. I guess we are not on their email list...
Left by Eddie on May 01, 2012 2:52 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks for this solution,it solves my problem
Left by Harish Jain on May 12, 2012 6:26 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you very much, This post saved my time,
Thanks Again
Left by Dinusha on May 21, 2012 1:47 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks for the post.
Left by Tamoj on Jun 12, 2012 8:50 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
I set it to 5000, it solves my problem. What is the impact of setting it to more as 10000.
Left by Sanjay Patil on Jun 28, 2012 8:51 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
The amount you specify has an impact on upload speed of your content, will be proportionally slower. Also the larger it is the more you are open to users uploading files that may be considered inappropriately large in the context of the purpose of the site/page and overloading your storarge capacity.
Left by renso on Jun 30, 2012 10:54 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thank you very much
Left by Sanjay Patil on Jul 03, 2012 6:19 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks a lot!!
Left by hemant singh on Jul 27, 2012 10:37 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks a lot :-)
Left by Ankur Negi on Aug 09, 2012 3:28 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
thx a lot,, I set to 4000 and it's work..

but I still didn't understand why it getting error, when my sheet name use char ' in front and when I erase the char ' I getting this error,,

But after all, thx a lot
Left by Ly Lele on Sep 20, 2012 11:04 PM

# Operation is not valid due to the current state of the object.
Requesting Gravatar...
I am using folowing cod to sent email

MailAddress mailfrom = new MailAddress ( "saylib4@gmail.com" );
MailAddress mailto = new MailAddress ( "txtEmail.Text.ToString()" );
MailMessage newmsg = new MailMessage ( mailfrom, mailto );

newmsg.Subject = "Your PAssword is";
newmsg.Body = "Your PAssword is";

////For File Attachment, more file can also be attached

//Attachment att = new Attachment ( "G:\\code.txt" );
//newmsg.Attachments.Add ( att );

SmtpClient smtps = new SmtpClient ( "smtp.gmail.com", 587 );
smtps.UseDefaultCredentials = false;
smtps.Credentials = new System.Net.NetworkCredential ( "mail@gmail.com", "pwd" );
smtps.EnableSsl = true;
smtps.Send ( newmsg );
Left by sayli on Oct 11, 2012 5:08 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
really its work fine.. thanks
Left by bhasker on Jan 23, 2013 12:33 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
OMG, thank you so much for this awesome quick fix. First google result too!

Thanks.
Left by Matthew on Jan 23, 2013 7:58 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
{System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)
at Oracle.DataAccess.Client.OracleDataReader.get_Item(Int32 i)
at Oracle.DataAccess.Client.OracleDataReader.get_Item(String columnName)
Left by shashi on May 07, 2013 10:05 AM

# Operation is not valid due to the current state of the object. i have added max size in webconfig but still error occcur
Requesting Gravatar...
plz help me
Thanks u in advanced
Left by sandip on Jun 01, 2013 3:42 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks, saved my time
Left by Nishi on Jun 20, 2013 1:03 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Yes after i raised it to 4000,it works , Thanks
Left by Gokul on Jul 02, 2013 10:39 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanks for this post. The error message is so vague and the stack output really not that helpful. Great Post!
Left by Mr.Kazoo on Aug 14, 2013 4:28 PM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
Thanksss it worked...
Left by supriya upadhyay on Sep 05, 2013 9:38 AM

# re: Operation is not valid due to the current state of the object.
Requesting Gravatar...
And it just keeps on helping! Thank you SO much for this
Left by Debbie on May 13, 2014 11:21 AM

Your comment:
 (will show your gravatar)


Copyright © Renso | Powered by: GeeksWithBlogs.net | Join free