שלום 
אז המשכתי לבנות את האתר שאני משתמש ב-MasterPage, והגעתי לעמוד ההתחברות.
עכשיו בניתי את העמוד, אך שאני מנסה להתחבר, אני מקבל שגיאה.
קוד הדף הוא:
<%@ Page Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Default2" Title="First Website - Login" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script runat="server"> private void BTNLogin_OnClick(object sender, EventArgs e) { string message; if (TXTUsername.Text != "Admin" && TXTPassword.Text != "Admin") { message = "The details are incorrect"; } else if (TXTUsername.Text == "Admin" && TXTPassword.Text == "Admin") { HttpCookie UserNameCookie = new HttpCookie("Username"); UserNameCookie.Value = "Admin"; UserNameCookie.Expires = DateTime.Now.AddYears(1); Response.Cookies.Add(UserNameCookie); HttpCookie PasswordCookie = new HttpCookie("Password"); PasswordCookie.Value = "Admin"; PasswordCookie.Expires = DateTime.Now.AddYears(1); Response.Cookies.Add(PasswordCookie); } } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <form> <table> <tr> <td>Username: </td> <td><asp:TextBox ID="TXTUsername" runat="server" /></td> </tr> <tr> <td>Password: </td> <td><asp:TextBox ID="TXTPassword" TextMode="Password" runat="server" /></td> </tr> <tr> <td colspan="2"><asp:Button ID="BTNLogin" Text="Login" OnClick="BTNLogin_OnClick" runat="server" /> <input type="reset" value="Reset" /></td> </tr> </table> </form> </asp:Content>
|
אני גם מנסה להוסיף לעמוד בתחילת העמוד את ה-
EnableEventValidation="true"
|
אבל זה עדיין ממשיך עם אותה שגיאה.
מה שזה רושם לי:
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.
מישהו יודע אולי למה?
אני משכונע שהבעייה נובעת משימוש לא נכון ב-MasterPage...
אשמח לקבל עזרה 
תודה רבה.