只有IE10返回无效的回发

时间:2013-07-29 17:08:19

标签: asp.net vb.net

我发誓我和微软有一段爱恨交织的关系。这只是在IE 10中抛出。

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

现在,

  1. 在@page上我有ValidateRequest =“False”

  2. 在Web.config中我有httpRuntime requestValidationMode =“2.0”

  3. 我不使用任何Ajax或使用ScriptManager

  4. 我正在检查PostBack

  5. 删除了组合框代码但它确实使用了AutoPostBack

  6. 这是我的代码

    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
    

1 个答案:

答案 0 :(得分:1)

这可能会也可能不会解决问题。

.NET 4及更早版本不知道IE 10是什么。它不在.NET所知的浏览器列表中,所以.NET假定浏览器是无法处理的东西......好吧,真的。 Javascript和cookies,我怀疑更多,搞砸了。所以:

下载:http://www.hanselman.com/blog/content/binary/App_BrowsersUpdate.zip,取自此处:

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

从这里引用:IE10 User-Agent causes ASP.Net to not send back Set-Cookie (IE10 not setting cookies)

提取文件并将它们放入应用程序的App_Browser目录中。重建并查看是否有效。