I used the "AddToRole" that add a user to a role. However this change cannot be applied immediately, this user has to sign out and sign in to apply.
So how to update this change immediately?
Thank you!
I used the "AddToRole" that add a user to a role. However this change cannot be applied immediately, this user has to sign out and sign in to apply.
So how to update this change immediately?
Thank you!
If you use ASP.Net Identity 2.0, this is where the SecurityStamp comes to rescue! Calling UpdateSecurityStampAsync will invalidate the user's cookie and refresh its roles:
UserManager.UpdateSecurityStampAsync(userId);
More info: What is ASP.NET Identity's IUserSecurityStampStore<TUser> interface?