0

我发誓我与微软有着爱恨交织的关系。这仅在 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

这是我的代码

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
4

1 回答 1

1

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

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

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

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

从这里引用:IE10 User-Agent 导致 ASP.Net 不发回 Set-Cookie (IE10 not setting cookie)

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

于 2013-07-29T17:23:15.967 回答