#39;Operation is not valid due to the current state of the object#39; error during postback(回发期间的“由于对象的当前状态,操作无效错误)
问题描述
我有一个运行良好的 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
这篇关于回发期间的“由于对象的当前状态,操作无效"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:回发期间的“由于对象的当前状态,操作无效"错误
基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01