Search code examples
asp.netasp.net-identityasp.net-identity-2

SignOut is not working when calling after PasswordSignIn?


In ASP.NET Identity I am have,

var result = await _userManager.PasswordSignIn(model.Email, model.Password, model.RememberMe, true);
if(result == SignInStatus.Success)
{
    if (myCondition)
    {
        _userManager.SignOut();
    }
}

Here the SignOut is not working. Means user is logged-in.


Solution

  • So this is a bug in Katana, which I believe will be fixed in the aspnet vNext update, the basic issue is that when you are calling both SignIn and SignOut in the same request, the logical assumption is that the last one wins. I believe today, its either only the first one, or SignIn always wins over SignOut.

    The issue was tracked here Katana codeplex issue