我们在其中一个使用.NET 2.0构建的应用程序中有一个报表生成器
每当我们尝试在IE 10中运行报告时,我们会收到服务器错误,并显示以下消息:
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) +8636377
System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +360
System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +343
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5420; ASP.NET
Version:2.0.50727.5420
仅当我们在IE 10中运行报告时才会发生此错误。
如果我们使用任何其他IE版本或任何其他浏览器,我们不会收到任何错误,报告运行正常。
根据Microsoft文档,这在.NET 3及更高版本上得到了解决。但我们已经拥有.NET 3.5,但仍无法在IE 10上运行。
这是页眉:
<%@ Page EnableEventValidation="true" Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Client_Id.Value = Request.QueryString("Client_Id")
Project_Id.Value = Request.QueryString("Project_Id")
System_Id.Value = Request.QueryString("System_Id")
Report_Page_Heading.Text = Replace(Request.QueryString("H"), "'", "")
PartExportFields.SelectParameters.Add("Client_Id", Replace(Client_Id.Value, "'", ""))
PartExportFields.SelectParameters.Add("Project_Id", Replace(Project_Id.Value, "'", ""))
PartExportFields.SelectParameters.Add("System_Id", Replace(System_Id.Value, "'", ""))
SavedCustomReports.SelectParameters.Add("Client_Id", Replace(Client_Id.Value, "'", ""))
SavedCustomReports.SelectParameters.Add("Project_Id", Replace(Project_Id.Value, "'", ""))
SavedCustomReports.SelectParameters.Add("System_Id", Replace(System_Id.Value, "'", ""))
ListBox1.SelectedValue = Request.QueryString("edit")
End Sub
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation("Client_Id", Replace(Client_Id.Value, "'", ""))
Page.ClientScript.RegisterForEventValidation("Project_Id", Replace(Project_Id.Value, "'", ""))
Page.ClientScript.RegisterForEventValidation("System_Id", Replace(System_Id.Value, "'", ""))
MyBase.Render(writer)
End Sub
</script>
任何想法或帮助都会很棒。
提前致谢!
答案 0 :(得分:0)
我遇到了与IE 10类似的问题.IE 10与webforms不相称(具有讽刺意味的是微软技术不适用于微软技术)。见link。您可以应用一些机器范围的补丁来解决一些问题。此外,使用一些Microsoft Ajax的东西在IE 10中根本不起作用。我能够解决的唯一方法是发送一个告诉IE以IE 9模式运行页面的标题。
答案 1 :(得分:0)
我发现的唯一解决方案是运行Windows Update。
这下载了IE的所有必要修复程序。
之后错误消失了。