c# - 当我选择下拉列表时,由于对象的当前状态,操作无效

标签 c# asp.net telerik

<分区>

我在 aspx 页面上有 radcombo 框,当我从中选择任何选项时,它会给出错误`“/”应用程序中的服务器错误。

由于对象的当前状态,操作无效。 说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.

来源错误:

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.

堆栈跟踪:

[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302 System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
System.Web.HttpRequest.FillInFormCollection() +148

[HttpException (0x80004005): The URL-encoded form data is not valid.] System.Web.HttpRequest.FillInFormCollection() +206
System.Web.HttpRequest.get_Form() +68
System.Web.HttpRequest.get_HasForm() +8735447
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97 System.Web.UI.Page.DeterminePostBackMode() +63 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133


Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634 `

最佳答案

来自 http://codecorner.galanter.net/2012/06/04/solution-for-operation-is-not-valid-due-to-the-current-state-of-the-object-error/

Issue happens because Microsoft Security Update MS11-100 limits number of keys in Forms collection during HTTP POST request. To alleviate this problem you need to increase that number.

This can be done in your application Web.Config in the <appSettings> section (create the section directly under <configuration> if it doesn’t exist). Add 2 lines similar to the lines below to the section:

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

The above example set the limit to 2000 keys. This will lift the limitation and the error should go away.

关于c# - 当我选择下拉列表时,由于对象的当前状态,操作无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10697194/

相关文章:

c# - SignalR 连续消息传递

ASP.NET 正则表达式验证器

asp.net - 为什么在 asp.net 中使用表单例份验证时会忽略本地样式?

javascript - 在下拉所选索引更改事件上刷新 Kendo UI 网格

c# - 在不触发 ValueChanged 的​​情况下设置 RadDatePicker 日期

c# - "Loop"在 C# 中不工作

c# - 为什么我们需要在某些对象上使用 Dispose() 方法?为什么垃圾收集器不做这项工作?

javascript - 捷列里克。 RadGrid 在客户端事件中获取 DataKeyField 值

c# - 如何检查循环中的类型?

c# - WP - 删除功能,但仅适用于 "new buyers"