【发布时间】:2015-03-31 12:49:52
【问题描述】:
我正在尝试退出应用程序,但身份验证 cookie 没有被删除。下面是我的实现
//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
});
【问题讨论】:
-
会不会和这个有关:stackoverflow.com/questions/20737578/…?
标签: c# asp.net-mvc asp.net-identity