原在ASP.NET1.0中,运行正常!但改了2.0后,在登录时,点击提交按钮后,系统总是提示:
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> 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. 不知是什么问题?急!!!

解决方案 »

  1.   

    debug一下吧就可以看到那里出错了
      

  2.   

    不行呀,调试还是一样的错误!
    下面是窗体的代码:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="../Main.css" type="text/css" rel="stylesheet" />
    <title>书店图书网络管理系统</title>
    </head>
    <body background="Img/Index_Sbg.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style='overflow:scroll;overflow-y:hidden;overflow-x:hidden'">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <form runat=server>
    <table width="780" height="330" border="0" align= "center" cellpadding="0" cellspacing="0" background="Img/BackGround.jpg" >
      <tr> 
        <td width="760" height="20%" ></td>
      </tr>
      <tr> 
        <td width="760" height="60%"> 
          <table width=76% height=442% align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width=4% height="323"><div align="right"></div></td>
              <td width=96% valign="top"> 
                  <table width="220" height="139" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="220" height="33"><div align="center"><strong><font color="#FFFFFF" size="2">系 
                          统 登 录</font></strong></div></td>
                    </tr>
                    <tr> 
                      <td height="39"> <div align="justify"><font color="#FFFFFF" size="2">名称: 
                          <asp:TextBox id="UserName" class="input_selectAndtext" maxlength="30" runat="server"></asp:TextBox>
          <br>
                          <asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ErrorMessage="*" Display="Static" ControlToValidate="UserName">请输入用户名称</asp:RequiredFieldValidator>
                      </font></div></td>
                    </tr>
                    <tr> 
                      <td height="38"><font color="#FFFFFF" size="2">口令: 
                          <asp:TextBox id="UserPass" runat="server" class="input_selectAndtext" TextMode="Password"></asp:TextBox>
                          <br>
                          <asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ErrorMessage="*" Display="Static" ControlToValidate="UserPass">请输入用户口令</asp:RequiredFieldValidator>
                        </font></td>
                    </tr>
                    <tr> 
                      <td height="29" align="right"> <div align="center">
          <asp:button id="LoginBtn" onclick="LoginBtn_Click" class="input_button" runat="server" text="登 录"></asp:button>
                        </div></td>
                    </tr>
                  </table>
             </td>
           </tr>
         </table>
        </td>
      </tr> 
      <tr> 
        <td width="760" height="20%"></td>
      </tr>
    </table> 
    <p align="center">
      <asp:Label id="Msg" runat="server" forecolor="red"></asp:Label>
    </p>
    </form>
    </body> 
    </html> 下面是提交后的代码:
    <script runat="server">
        Sub LoginBtn_Click(Sender As Object, E As EventArgs)
            dim Cnn as sqlconnection
            dim cmd as sqlcommand
            dim dataR as sqldatareader
            If Page.IsValid Then
                cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                cmd=new sqlcommand("select * from pub_user where lname='" & username.text & "' and pass='" & userpass.text & "'",cnn)
                cnn.open()
                datar=cmd.executereader()
                If datar.read() Then
    Dim objCookie As New HttpCookie("curruser", datar("code").tostring())
    Response.Cookies.Add(objCookie)
    Dim objCookie1 As New HttpCookie("dispuser", datar("name").tostring())
    Response.Cookies.Add(objCookie1)
    Dim objCookie2 As New HttpCookie("logintime", now())
    Response.Cookies.Add(objCookie2)
                    response.redirect ("main.aspx")
                Else
                    Msg.Text = "对不起,账号或密码错误!"
                End If
            End If
        End Sub
    </script>恳请各位相助,万分感谢!!!