如何使asp.net身份帐户一次输入?连接系统的用户,以及另一个人使用相同的电子邮件进入该帐户的用户。我想自动注销以前的用户。
有你的要求吗?或使用您的DefaultCookie?
等待您的帮助。
您可以将验证间隔设置为0,以便每次检查数据库以进行Cookie验证时:
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.FromSeconds(0),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
并且,当用户登录时,请更改其SecurityStamp。这将使每个现有的cookie失效:
UserManager.UpdateSecurityStamp(userId);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句