EnableEventValidation,ClientScriptManager.RegisterForEventValidation错误原因分析以及解决办法

一个比较古老的项目突然报错

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

按照提示,修改或添加当前页面参数

<%@ Page EnableEventValidation="false" %> 

或者直接在web.config,修改项目设置

<system.web>
    <pages EnableEventValidation="false"/>
</system.web>

上述设置的确可以让页面正常运行,有点万能的赶脚。

但是页面真正无法执行的原因却没找到。

经过仔细寻找,最终确定是页面中某个控件 asp:DropDownList调用的数据中有乱码导致:

在确认乱码数据是垃圾数据后,果断从数据表中删除相关数据,问题彻底解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JackieZhengChina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值