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
});
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.