我已經實現了asp.net mvc與asp.net身份認證。Asp.net標識 - 重置iis循環中的cookie和會話(重新啓動)
我已經使用基於cookie的身份驗證。在重新啓動IIS/stop併爲我的站點啓動IIS後,當我打開我的網站時,用戶將自動登錄到系統。
用戶cookie未被清除,仍然對用戶有效。如何在重新啓動iis後強制用戶註銷?
我使用了網站的默認樣本。 http://www.nuget.org/packages/Microsoft.AspNet.Identity.Samples
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
所以在登錄時,你總是添加'用戶名'到會話? – trailmax
是的,我們正在使用 –