Operation Is Not Valid Due To The Current State Of The Object.

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/5/2012 1:47:41 PM
Gravatar
Total Posts 148

Operation Is Not Valid Due To The Current State Of The Object.

Hi:

I am writing a control that uses an edit page. On one machine the control works fine.  But if I switch to another machine with a newer version of mojoPortal I receive the following error after hitting the "Update" mojo button:

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.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2420258    System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +58    System.Web.HttpRequest.FillInFormCollection() +159

[HttpException (0x80004005): The URL-encoded form data is not valid.]    System.Web.HttpRequest.FillInFormCollection() +217    System.Web.HttpRequest.get_Form() +104    System.Web.HttpRequest.get_HasForm() +9038047    System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97    System.Web.UI.Page.DeterminePostBackMode() +69    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +135

 

 

2/5/2012 1:55:38 PM
Gravatar
Total Posts 18439

Re: Operation Is Not Valid Due To The Current State Of The Object.

It means one machine has the latest windows updates and the other one does not, and your page exceeds the new limit of 1000 form elements. The cause is a recent ASP.NET security update and a workaround is discussed on this thread.

Note that the hidden field sused for viewstate may be a significant factor in the number of form elements so setting EnableViewState="false" on any controls that don't need it may help.

Hope that helps,

Joe

2/5/2012 2:24:21 PM
Gravatar
Total Posts 148

Re: Operation Is Not Valid Due To The Current State Of The Object.

Hi:

Thanks so much Joe.  You saved me so much time.  Have a Beer!

2/6/2012 6:43:54 AM
Gravatar
Total Posts 18439

Re: Operation Is Not Valid Due To The Current State Of The Object.

Thanks for the beer! Much appreciated.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.