[ASPNET]ASP.NET Event Validation and “Invalid Callback Or Postback Argument” Troubleshooting info

本文探讨了ASP.NET中常见的事件验证错误“Invalid postback or callback argument”,解释了该问题出现的原因,包括客户端HTML输入数据意外更改及网络传输缓慢导致页面未完全加载就被提交等情形。同时提供了解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blogs.msdn.com/b/stcheng/archive/2009/01/16/aspnet-asp-net-event-validation-and-invalid-callback-or-postback-argument-troubleshooting-info.aspx

There are many community members encountering this problem. Symptom is just as the following exception on ASPX page when postback.

 

Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true" /> 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 toregister the postback or callback data for validation.

 

The event validation is added from ASP.NET 2.0, Scott Allen has provided several good blog entries explaining it. The following two described the basic ideas and causes of this error:

 

ASP.NET Event Validation and “Invalid Callback Or Postback Argument” Part I

http://odetocode.com/Blogs/scott/archive/2006/03/20/3145.aspx

 

ASP.NET Event Validation and “Invalid Callback Or Postback Argument” : Part II

http://odetocode.com/blogs/scott/archive/2006/03/21/3153.aspx

 

In addition to the unexpected change of some html input data(such as <select> list) at client, there is another frequently happened cause:

 

Sometimes due to slow network tranmiting, the page is flushed to client-side gradually. And the client user may submit the page before the event validation’s <input type=’hidden’ /> field(just like the viewstate hiden field) rendered to client. Then, such postback will result to the exception at the beginning. This issue has also been well explained by Scott:

 

Event Validation Errors and Network Congestion in ASP.NET

http://odetocode.com/Blogs/scott/archive/2007/04/13/10696.aspx

 

some other causes may include:

 

l  There is some unregistered ActiveX control that cause page get rendered very slowly

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值