<%@ Page Language="VB" %> <script runat="server"> Sub LoginBtn_Click(Sender As Object, E As EventArgs) If Page.IsValid Then If (UserName.Text = "email@provedor.com") And (UserPass.Text = "password") Then FormsAuthentication.RedirectFromLoginPage(UserName.Text, true) Else Msg.Text = "Dados inválidos" End If End If End Sub </script> <html> <head> </head> <body style="FONT-FAMILY: arial"> <form runat="server"> <h2>Login Page </h2> <hr size="1" /> <table> <tbody> <tr> <td> Username:</td> <td> <asp:TextBox id="UserName" runat="server"></asp:TextBox> </td> <td> <asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ErrorMessage="*" Display="Static" ControlToValidate="UserName"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Password:</td> <td> <asp:TextBox id="UserPass" runat="server" TextMode="Password"></asp:TextBox> </td> <td> <asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ErrorMessage="*" Display="Static" ControlToValidate="UserPass"></asp:RequiredFieldValidator> </td> </tr> </tbody> </table> <asp:button id="LoginBtn" onclick="LoginBtn_Click" runat="server" text="Login"></asp:button> <p> <asp:Label id="Msg" runat="server" ForeColor="red"></asp:Label> </p> </form> </body> </html>
t+