I have a login form on my page that works correctly but when I added the loginview I could no longer see the login1.username or the login1.password in the code behind page, how can I find them? i have been trying for a while.
Code:
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server" BackColor="#F7F7DE" BorderColor="#CCCC99"
BorderStyle="Solid" BorderWidth="1px" DestinationPageUrl="~/login.aspx"
FailureText="wrong email or password" Font-Names="Verdana" Font-Size="10pt"
onauthenticate="Login1_Authenticate" RememberMeText="Remember me "
UserNameLabelText="Email:" VisibleWhenLoggedIn="true" Width="347px">
<TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" />
</asp:Login>
<asp:LoginStatus ID="LoginStatus1" runat="server" />
</AnonymousTemplate>
<LoggedInTemplate>
<asp:LoginStatus ID="LoginStatus2" runat="server" />
</LoggedInTemplate>
</asp:LoginView>
Code:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string userName = LoginView1.FindControl("Login1.UserName");
string password = LoginView1.FindControl("Login1.password");
bool result = UserLogin(userName, password);
if ((result))
{
e.Authenticated = true;
}
else
{
e.Authenticated = false;
}
}