C# 注销功能不适用于ASP.NET标识
我正在尝试注销应用程序,但身份验证cookie未被删除。下面是我的实现C# 注销功能不适用于ASP.NET标识,c#,asp.net-mvc,asp.net-identity,C#,Asp.net Mvc,Asp.net Identity,我正在尝试注销应用程序,但身份验证cookie未被删除。下面是我的实现 //Log in action var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, loginModel.UserName), }, DefaultAuthenticationTypes.A
//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
});
以防对其他人有用。在将一个项目从MVC2升级到MVC5后,我在Chrome中遇到了这个问题,但在IE中没有。我花了好几天的时间试图解决这个问题,然后决定更新我的基本控制器中的一些跟踪代码。重新编译后,问题消失了 我不想重复我的步骤来验证这个解决方案,但我想知道项目是否需要一个干净的重新编译,并通过修改引用标识的其他代码来实现相同的目的。它是否与此相关:?