"Your login attempt was not successful. Please try again"
protected void Login1_LoginError(object sender, System.EventArgs e) { System.Web.UI.WebControls.Login Login1 = (System.Web.UI.WebControls.Login)LoginView1.FindControl("Login1"); TextBox UserName = (TextBox)Login1.FindControl("UserName"); Literal FailureText = (Literal)Login1.FindControl("FailureText"); //There was a problem logging in the user //See if this user exists in the database MembershipUser userInfo = Membership.GetUser(UserName.Text); if (userInfo == null) { //The user entered an invalid username... FailureText.Text = "There is no user in the database with the username " + UserName.Text; } else { //See if the user is locked out or not approved if (!userInfo.IsApproved) { FailureText.Text = "When you created your account you were sent an email with steps to verify your account. You must follow these steps before you can log into the site."; } else if (userInfo.IsLockedOut) { FailureText.Text = "Your account has been locked out because of a maximum number of incorrect login attempts. You will NOT be able to login until you contact a site administrator and have your account unlocked."; } else { //The password was incorrect FailureText.Text = "Invalid Password. Please try again." ; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)