回发期间的“由于对象的当前状态,操作无效"错误

#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

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)