无效的回发或回调参数

无效的回发或回调参数

本文介绍了无效的回发或回调参数。事件验证使用启用'<网页enableEventValidation ="真" />“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误,当我回来后一页,从客户端。我的JavaScript code表示修改一个asp:在客户端列表框

我们如何解决这个问题?

下面的错误信息:

 在/ XXX应用程序的服务器错误。

-------------------------------------------------- ------------------------------
无效的回发或回调参数。事件验证使用&LT启用;页面enableEventValidation =真/>在配置或LT;%@页EnableEventValidation =真正的%>在一个页面。为了安全起见,此功能验证参数回发或回调事件的服务器控件最初呈现这些。如果数据有效并且是预期的,则使用来注册回发或回调数据以进行验证ClientScriptManager.RegisterForEventValidation方法。
描述:在当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细堆栈跟踪信息,以及它起源于code。

异常详细信息:System.ArgumentException:无效的回发或回调参数。事件验证使用&LT启用;页面enableEventValidation =真/>在配置或LT;%@页EnableEventValidation =真正的%>在一个页面。为了安全起见,此功能验证参数回发或回调事件的服务器控件最初呈现这些。如果数据有效并且是预期的,则使用来注册回发或回调数据以进行验证ClientScriptManager.RegisterForEventValidation方法。

源错误:

当前Web请求的执行过程中生成了未处理的异常。有关异常原因和位置的信息可以使用下面的异常堆栈跟踪信息确定。

堆栈跟踪:

[ArgumentException的:无效的回发或回调参数。事件验证使用&LT启用;页面enableEventValidation =真/>在配置或LT;%@页EnableEventValidation =真正的%>在一个页面。为了安全起见,此功能验证参数回发或回调事件的服务器控件最初呈现这些。如果数据有效并且是预期,使用ClientScriptManager.RegisterForEventValidation方法来注册回发或回调数据以进行验证。]
   System.Web.UI.ClientScriptManager.ValidateEvent(字符串UNIQUEID,字符串参数)2132728
   System.Web.UI.Control.ValidateEvent(字符串UNIQUEID,字符串eventArgument)+108
   System.Web.UI.WebControls.ListBox.LoadPostData(字符串postDataKey,NameValueCollection中postCollection)+274
   System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(字符串postDataKey,NameValueCollection中postCollection)+11
   System.Web.UI.Page.ProcessPostData(NameValueCollection中POSTDATA,布尔fBeforeLoad)+353
   System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)1194

-------------------------------------------------- ------------------------------
版本信息:Microsoft .NET Framework版本:2.0.50727.1433; ASP.NET版本:2.0.50727.1433
 

解决方案

问题是,ASP.NET并没有更多地了解这个额外的或删除列表项。你有选项的数量(如下所示):

  • 禁用eventvalidation(坏主意,因为你失去了一个小保安的附带很少的费用)。
  • 使用ASP.NET AJAX的UpdatePanel。 (放入UpdatePanel中的列表框和触发更新,如果您添加或删除列表框,这样视图状态和相关领域得到更新和eventvalidation将成为过去。)
  • 忘记客户端,并使用经典的回发,并添加或删除listItems中的服务器端。

我希望这有助于。

I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side.

How do we fix this?

Error details below:

Server Error in '/XXX' Application.

--------------------------------------------------------------------------------
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 to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: 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 to register the postback or callback data for validation.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: 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 to register the postback or callback data for validation.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2132728
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108
   System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +274
   System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +353
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
解决方案

The problem is that ASP.NET does not get to know about this extra or removed listitem.You got an number of options (listed below):

  • Disable eventvalidation (bad idea, because you lose a little of security that come with very little cost).
  • Use ASP.NET Ajax UpdatePanel. (Put the listbox in the Updatepanel and trigger a update, if you add or remove listbox. This way viewstate and related fields get updates and eventvalidation will pass.)
  • Forget client-side and use the classic postback and add or remove the listitems server-side.

I hope this helps.

这篇关于无效的回发或回调参数。事件验证使用启用'&LT;网页enableEventValidation =&QUOT;真&QUOT; /&GT;“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 06:25