title: How do I enable the AccessFailedCount and Lockout functionality on ASP.net Identity 2.0?
body: <p>I have try to for increment   AccessFailedCount using this code but it’s not working (In AspNetUsers table not increment AccessFailed Count).
  => In this Code My first reaction was that , When User Is Failed to Login so Increment the AccessFailed Count But Not Worked that Code So Please give me Suggestion for update code and any things.  </p>
  
  <pre><code>                var manager = Context.GetOwinContext().GetUserManager&lt;ApplicationUserManager&gt;();
  
                  // find user by username first
                  var user = manager.FindByName(txtUserName.Text);
  
                  if (user != null)
                  {
                          var validCredentials = manager.Find(txtUserName.Text, txtPassword.Text);
  
                          // When a user is lockedout, this check is done to ensure that even if the credentials are valid
                          // the user can not login until the lockout duration has passed
                          if (manager.IsLockedOut(user.Id))
                          {
                           error message;
                          }
  
                          // if user is subject to lockouts and the credentials are invalid
                          // record the failure and check if user is lockedout and display message, otherwise,
                          // display the number of attempts remaining before lockout
                          else if (manager.GetLockoutEnabled(user.Id) &amp;&amp; validCredentials == null &amp;&amp; manager.SupportsUserLockout)
                          {
                              // Record the failure which also may cause the user to be locked out
                              manager.AccessFailed(user.Id);
  
                              if (manager.IsLockedOut(user.Id))
                              {
                                  error message;
                              }
                              else
                              {
                                  int accessFailedCount = manager.GetAccessFailedCount(user.Id);
  
                              }
  
                          }
                          else
                          {
  
                                      IdentityHelper.SignIn(manager, user, RememberMe.Checked);
  
                                      // When token is verified correctly, clear the access failed count used for lockout
                                      manager.ResetAccessFailedCount(user.Id);
                                      Response.Redirect("/Home.aspx", false);
  
                          }
  
                    }
  </code></pre>