wozniak 0 Denunciar post Postado Novembro 26, 2003 <%@ 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+ Compartilhar este post Link para o post Compartilhar em outros sites
wozniak 0 Denunciar post Postado Novembro 26, 2003 página de logout: <%@ Page Language="VB" %><script runat="server"> Sub Page_Load(Sender As Object, E As EventArgs) If (Request.IsAuthenticated = true) Then Status.Text = "User " & User.Identity.Name & " is currently logged in." End If End Sub Sub LogOffBtn_Click(Sender As Object, E As EventArgs) FormsAuthentication.SignOut() Status.Text = "Not authenticated." End Sub</script><html><head></head><body style="FONT-FAMILY: arial"> <form id="Form1" runat="server"> <h2>Log Off Page </h2> <hr size="1" /> <p> Status: <asp:Label id="Status" runat="server" ForeColor="red"></asp:Label> </p> <asp:button id="LogOffBtn" onclick="LogOffBtn_Click" runat="server" text="Log Off"></asp:button> </form></body></html> t+ Compartilhar este post Link para o post Compartilhar em outros sites