0

I swear I have a love hate relationship with Microsoft. This is being thrown only in IE 10.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/>

Now,

  1. On the @page I have ValidateRequest = "False"

  2. In the Web.config I have httpRuntime requestValidationMode="2.0"

  3. I am NOT using any Ajax or have a ScriptManager

  4. I am checking for PostBack

  5. Removed combobox code but it does use AutoPostBack

Here is my code

Private Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init

    Try
      
        Dim User As New UserRole(Me.SiteID, Master.UserName)

        If User.GetLevel(Permissions.Edit) >= Levels.Page Then

            Exit Sub

        End If

    Catch ex As Exception

    End Try

    Response.Redirect("/Manage/Errors/Unauthorized.aspx")

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Me.IsPostBack = True Then

        Exit Sub

    End If

    Try

        Dim Item As New PageBase(Me.PageID)

        Me.txtCode.Text = Item.Code

    Catch ex As Exception

        Master.ShowError("Flex encountered a problem reading this page.")

    End Try

End Sub

Private Sub cmbSnippet_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbSnippet.SelectedIndexChanged

    If Me.cmbSnippet.SelectedIndex = 0 Then

        Exit Sub

    End If

    Try

        Dim Filename As String = String.Format("/Manage/Editors/Text/Scripts/{0}", Me.cmbSnippet.SelectedValue)

        Me.txtCode.Text = My.Computer.FileSystem.ReadAllText(Server.MapPath(Filename))

        Exit Sub

    Catch ex As Exception

    End Try

    Master.ShowError("Flex encountered a problem reading the snippet.")

End Sub

Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click

    Try

        Dim Item As New PageBase(Me.PageID)

        Item.Code = Me.txtCode.Text

        If Item.Update = True Then

            Me.ShowUpdateTime()

            Exit Sub

        End If

    Catch ex As Exception

    End Try

    Master.ShowError("Flex encountered a problem modifying this page.")

End Sub

Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click

    Response.Redirect(String.Format("/Manage/Preview.aspx?PageID={0}", Me.PageID))

End Sub
Community
  • 1
  • 1
Eric Harms
  • 569
  • 5
  • 17
  • please put backticks around the xml segment so it is visible – Russell Uhl Jul 29 '13 at 17:25
  • Have you tried besides `ValidateRequest = "False"` at @page add `EnableEventValidation="false"`? – Yuriy Galanter Jul 29 '13 at 17:52
  • Are `btnOk` and `btnCancel` regular `Button` controls or `LinkButton` or `ImageButton` controls? – Joe Enos Jul 29 '13 at 17:54
  • Yes. Did Both. btnOk / btnCancel are regular buttons. – Eric Harms Jul 29 '13 at 17:58
  • Take a look at the raw HTTP requests using Fiddler from both IE10 and a real browser, and compare them. I've seen an issue where IE10 posted things differently than other browsers, and ASP.NET didn't know how to handle it (it was related to `ImageButton` controls, so that's not it for you, but maybe it's something similar). – Joe Enos Jul 29 '13 at 18:02
  • EnableEventValidation works. Now. a Custom RequestValidator class does not. Could it be having problems with jQuery or another Script? I am not sure what Microsoft is throwing this for. Also, should I be enabling this? – Eric Harms Jul 29 '13 at 18:24

1 Answers1

1

This may or may not solve the issue.

.NET 4 and earlier don't know what IE 10 is. It's not in the list of browsers .NET knows about, so .NET assumes the browser is something that can't handle...well, anything really. Javascript and cookies, and I suspect more, get screwed over. So:

Download this: http://www.hanselman.com/blog/content/binary/App_BrowsersUpdate.zip, which is taken from here:

http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx,

which is referenced from here: IE10 User-Agent causes ASP.Net to not send back Set-Cookie (IE10 not setting cookies)

Extract the files and put them in your application's App_Browser directory. Rebuild and see if that works.

Community
  • 1
  • 1
Russell Uhl
  • 4,181
  • 2
  • 18
  • 28