回发期间的“由于对象的当前状态,操作无效"错误 [英] 'Operation is not valid due to the current state of the object' error during postback

查看:20
本文介绍了回发期间的“由于对象的当前状态,操作无效"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行良好的 aspx 页面,但突然我收到错误消息由于对象的当前状态,操作无效."每当回发完成时.

I had an aspx page which was working well, but suddenly I am getting the error "Operation is not valid due to the current state of the object." whenever a postback is done.

堆栈跟踪是:

在System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
在 System.Web.HttpValueCollection.FillFromEncodedBytes(字节 [] 字节,编码编码)
在 System.Web.HttpRequest.FillInFormCollection()

at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()

有人可以帮忙吗?

推荐答案

有人在您的页面上发布了很多表单字段.最近的安全更新引入的新默认最大值为 1000.

Somebody posted quite a few form fields to your page. The new default max introduced by the recent security update is 1000.

尝试在 web.config 的 <appsettings> 块中添加以下设置.在此块中,您将最大化 MaxHttpCollection 值,这将覆盖 .net Framework 设置的默认值.您可以根据您的表单需要相应地更改值

Try adding the following setting in your web.config's <appsettings> block. in this block you are maximizing the MaxHttpCollection values this will override the defaults set by .net Framework. you can change the value accordingly as per your form needs

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

有关更多信息,请阅读 this 帖子.要更深入地了解微软的安全补丁,您可以阅读这篇知识库文章

For more information please read this post. For more insight into the security patch by microsoft you can read this Knowledge base article

这篇关于回发期间的“由于对象的当前状态,操作无效"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆