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

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

问题描述

我就有一个运作良好的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.FillFromEn codedBytes(字节[]字节,
  编码编码)
在System.Web.Htt prequest.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的&LT添加下面的设置;的AppSettings> 块。在此块你最大化MaxHttpCollection值,这将覆盖由.NET框架设置的默认值。你可以更改相应的值按您需要的形式

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>

有关更多信息,请阅读<一href=\"http://stackoverflow.com/questions/8684049/asp-net-ms11-100-how-can-i-change-the-limit-on-the-maximum-number-of-posted-for\">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天全站免登陆