protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e) { System.Web.UI.WebControls.Login Login1 = (System.Web.UI.WebControls.Login)LoginView1.FindControl("Login1"); TextBox UserName = (TextBox)Login1.FindControl("UserName"); //Check to see if the current user exists if (Membership.GetUser(Login1.UserName) != null) { //Check to see if the user is currently locked out if (Membership.GetUser(Login1.UserName).IsLockedOut) { //Get the last lockout date from the user DateTime lastLockout = Membership.GetUser(Login1.UserName).LastLockoutDate; //Calculate the time the user should be unlocked DateTime unlockDate = lastLockout.AddMinutes(Membership.PasswordAttemptWindow); //Check to see if it is time to unlock the user if (DateTime.Now > unlockDate) Membership.GetUser(Login1.UserName).UnlockUser(); } } }
<add name="ASPNETDBConnectionString1" type="System.Web.Security.SqlMembershipProvider" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="false" requiresQuestionAndAnswer="true" passwordFormat="Hashed" enablePasswordRetrieval="false" enablePasswordReset="true" maxInvalidPasswordAttempts="2" passwordAttemptWindow="1" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)