#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
这篇关于回发期间的“由于对象的当前状态,操作无效"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:回发期间的“由于对象的当前状态,操作无效"错误
基础教程推荐
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- WPF 模态进度窗口 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
