title: Refresh current user's role when changed in ASP.NET identity framework?
body: <p><strong>Using VS 2013, standard MVC template, and the Identity provider framework</strong></p>
  
  <p>The user is logged in, and I have:</p>
  
  <pre><code>//....
  UserManager.AddToRole(User.Identity.GetUserId(), "Members");       # Line X
  RedirectToAction("Index", "Members");
  </code></pre>
  
  <p>And the Members controller is as follows:</p>
  
  <pre><code>[Authorize(Roles="Members")]
  public class MembersController : Controller
  {
      // GET: Members
      public ActionResult Index()
      {
          return View();
      }
  }
  </code></pre>
  
  <p>After Line X is executed, I can confirm that the user is added to the table <code>dbo.AspNetUserRoles</code>.  However, the user upon reaching the Members controller fails the role check.  <code>User.IsInRole("Members")</code> returns false.</p>
  
  <p>If the user logs off and then logs in again, then access to the Members controller will go through, ie <code>User.IsInRole("Members")</code> now returns true.</p>
  
  <p>Is there some caching? Why the delay? How do I overcome it?</p>
  
  <p>I also tried converting the method at Line X to an async method and used <code>UserManager.AddToRoleAsync</code>. The same delayed effect is still there.</p>