I\'m trying to follow this example on how to validate credentials. However, it uses asp: controls for the login form.
If I were to use html controls instead so CSS s
Add id
and runat
server attributes to the input tag (see below)
You also need to change Text
to Value
in your code:
protected void LoginButton_Click(object sender, EventArgs e)
{
// Validate the user against the Membership framework user store
if (Membership.ValidateUser(Username.Value, Password.Value))
{
// Log the user into the site
FormsAuthentication.RedirectFromLoginPage(UserName.Value, RememberMe.Checked);
}
// If we reach here, the user's credentials were invalid
InvalidCredentialsMessage.Visible = true;
}
You can also add a html checkbox
for RememberMe
Now you can check the checked states by calling RememberMe.Checked