title: IE 10 - Invalid postback or callback argument
body: <p>We have a report builder in one of our apps that was built in .NET 2.0</p>
  
  <p>Whenever we try to run a report in IE 10 we get a server error with the following message:</p>
  
  <pre><code>Invalid postback or callback argument.  Event validation is enabled using 
  &lt;pages enableEventValidation="true"/&gt; in configuration or 
  &lt;%@ Page EnableEventValidation="true" %&gt; 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 &lt;pages enableEventValidation="true"/&gt; 
  in configuration or &lt;%@ Page EnableEventValidation="true" %&gt; 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 &lt;pages enableEventValidation="true"/&gt; in configuration or &lt;%@ Page 
  EnableEventValidation="true" %&gt; 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 
  </code></pre>
  
  <p>This error is happening ONLY when we run the reports in IE 10.</p>
  
  <p>If we use any other IE version or any other browser, we don't get any error and the report runs fine.</p>
  
  <p>According to Microsoft documentation this is solved on .NET 3 and above. But we already have .NET 3.5 and still doesn't work on IE 10.</p>
  
  <p>This is the page header:</p>
  
  <pre><code>&lt;%@ Page EnableEventValidation="true" Language="VB"  %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;script runat="server"&gt;
  
  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    
  &lt;/script&gt;
  </code></pre>
  
  <p>Any ideas or help would be great.</p>
  
  <p>Thanks in advance!</p>