Asp.Net Login control (Visual Web Dev)
<p>This is the code when you take the Login control from the toolbox.</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;

        &lt;asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate" 
            BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" 
            Font-Names="Verdana" Font-Size="10pt"&gt;
            &lt;LayoutTemplate&gt;
                &lt;table border="0" cellpadding="1" cellspacing="0" 
                    style="border-collapse:collapse;"&gt;
                    &lt;tr&gt;
                        &lt;td&gt;
                            &lt;table border="0" cellpadding="0"&gt;
                                &lt;tr&gt;
                                    &lt;td align="center" colspan="2"&gt;
                                        Log In&lt;/td&gt;
                                &lt;/tr&gt;
                                &lt;tr&gt;
                                    &lt;td align="right"&gt;
                                        &lt;asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName"&gt;User Name:&lt;/asp:Label&gt;
                                    &lt;/td&gt;
                                    &lt;td&gt;
                                        &lt;asp:TextBox ID="UserName" runat="server" &gt;&lt;/asp:TextBox&gt;
                                        &lt;asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                            ControlToValidate="UserName" ErrorMessage="User Name is required." 
                                            ToolTip="User Name is required." ValidationGroup="Login1"&gt;*&lt;/asp:RequiredFieldValidator&gt;
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                                &lt;tr&gt;
                                    &lt;td align="right"&gt;
                                        &lt;asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password"&gt;Password:&lt;/asp:Label&gt;
                                    &lt;/td&gt;
                                    &lt;td&gt;
                                        &lt;asp:TextBox ID="Password" runat="server" TextMode="Password"&gt;&lt;/asp:TextBox&gt;
                                        &lt;asp:RequiredFieldValidator ID="PasswordRequired" runat="server" 
                                            ControlToValidate="Password" ErrorMessage="Password is required." 
                                            ToolTip="Password is required." ValidationGroup="Login1"&gt;*&lt;/asp:RequiredFieldValidator&gt;
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                                &lt;tr&gt;
                                    &lt;td colspan="2"&gt;
                                        &lt;asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." /&gt;
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                                &lt;tr&gt;
                                    &lt;td align="center" colspan="2" style="color:Red;"&gt;
                                        &lt;asp:Literal ID="FailureText" runat="server" EnableViewState="False"&gt;&lt;/asp:Literal&gt;
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                                &lt;tr&gt;
                                    &lt;td align="right" colspan="2"&gt;
                                        &lt;asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" 
                                            ValidationGroup="Login1" onclick="LoginButton_Click" /&gt;
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                            &lt;/table&gt;
                        &lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/LayoutTemplate&gt;
            &lt;TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" /&gt;
        &lt;/asp:Login&gt;

    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Part of my aspx.cs</p>

<pre><code>protected void LoginButton_Click(object sender, EventArgs e)
{
    String sUserName = UserName.Text;
    String sPassword = Password.Text;
</code></pre>

<p>Error   1   The name 'UserName' does not exist in the current context<br>
Error   2   The name 'Password' does not exist in the current context
Error   3   'ASP.default_aspx' does not contain a definition for 'Login1_Authenticate' and no extension method 'Login1_Authenticate' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?) </p>

<p>What am I doing wrong?</p>
