All pastes #807949 Raw Edit

Untitled

public text v1 · immutable
·published 2007-12-07 04:05 UTC
rendered paste body
ASPX

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="BottomLoginTab.ascx.cs" Inherits="BottomLoginTab" %>
<asp:LoginView id="LoginView1" runat="server">
    <AnonymousTemplate>
        <asp:Login ID="Login1" runat="server" OnAuthenticate="OnAuthenticate">
            <LayoutTemplate>
                <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
                <asp:TextBox ID="UserName" runat="server" CssClass="login"></asp:TextBox>
                <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
                <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                <asp:TextBox ID="Password" runat="server" TextMode="Password" CssClass="login"></asp:TextBox>
                <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
                <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                <asp:LinkButton ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl00$Login1" CssClass="login" />
            </LayoutTemplate>
        </asp:Login>
    </AnonymousTemplate>
    <LoggedInTemplate>
        Thanks for logging in.
    </LoggedInTemplate>
</asp:LoginView>


CS


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class BottomLoginTab : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void OnAuthenticate(object sender, AuthenticateEventArgs e) {
        bool Authenticated = false;
        if (System.Web.Security.FormsAuthentication.Authenticate(Login1.UserName, Login1.Password)) {
            Authenticated = true;
        }
       e.Authenticated = Authenticated;

    }
}