title: MVC 5 Identity 2.0 lockout doesn't work
body: <p>I need to block a user permanently. I don't understand why this code is not working. </p>
  
  <p>This line <code>UserManager.IsLockedOut(user.Id);</code> always returns <code>false</code> instead of <code>true</code>.</p>
  
  <p>Maybe it's necessary to put this line <code>UserManager.UserLockoutEnabledByDefault = true;</code> in user registration stage? </p>
  
  <pre><code>using (var _db = new ApplicationDbContext())
  {
      UserStore&lt;DALApplicationUser&gt; UserStore = new UserStore&lt;DALApplicationUser&gt;(_db);
      UserManager&lt;DALApplicationUser&gt; UserManager = new UserManager&lt;DALApplicationUser&gt;(UserStore);
      UserManager.UserLockoutEnabledByDefault = true;
      DALApplicationUser user = _userService.GetUserByProfileId(id);
      bool a = UserManager.IsLockedOut(user.Id);
      UserManager.SetLockoutEnabled(user.Id, true);
  
      a = UserManager.IsLockedOut(user.Id);
      _db.SaveChanges();
  }
  </code></pre>