Eric Harms
Eric Harms

Reputation: 569

Only IE10 returning Invalid Postback

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

Upvotes: 0

Views: 392

Answers (1)

Russell Uhl
Russell Uhl

Reputation: 4561

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.

Upvotes: 1

Related Questions