0

I am trying to sign out of the application, but the authentication cookie is not getting deleted. Below is my implementation

//Log in action
var identity = new ClaimsIdentity(new[] {
                            new Claim(ClaimTypes.Name, loginModel.UserName),
                        },
                        DefaultAuthenticationTypes.ApplicationCookie,
                        ClaimTypes.Name,
                        ClaimTypes.Role);

Authentication.SignIn(new AuthenticationProperties
                    {
                        IsPersistent = loginModel.RememberMe
                    }, identity);


//logout action          
  IAuthenticationManager Authentication
    {
                get { return HttpContext.GetOwinContext().Authentication; }
    }

Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

//startup
app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                //AuthenticationMode = AuthenticationMode.Active

            });
Sunny
  • 4,765
  • 5
  • 37
  • 72
  • Could it be related to this: http://stackoverflow.com/questions/20737578/asp-net-sessionid-owin-cookies-do-not-send-to-browser? – Phil Degenhardt Feb 02 '15 at 04:10

1 Answers1

0

In case it's useful to someone else. I had this problem in Chrome but not IE after upgrading a project from MVC2 to MVC5. I spent days trying to solve it and then decided to update some of the tracking code I had in my base Controller. After recompiling the problem went away.

I don't want to retrace my steps to verify this as a solution, but I'm wondering if the project needed a clean recompilation and by modifying other code that referenced the identity that it achieved the same thing.

christutty
  • 952
  • 5
  • 12