小编Mig*_*edo的帖子

ASP.Net 身份滑动过期设置为 true 不会重新发出 cookie

我正在使用 ASP.Net 身份验证来控制我的应用程序授权,我需要在指定的不活动时间后终止用户会话,我尝试通过执行以下方法来实现这一点

public void ConfigureAuth(IAppBuilder app) {
    app.CreatePerOwinContext<UserStore>(() => new UserStore());
    app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);

    app.UseCookieAuthentication(new CookieAuthenticationOptions {
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath = new PathString("/login"),
        LogoutPath = new PathString("/logout"),
        CookieDomain = ConfigurationManager.AppSettings["CookieDomain"],
        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(2),
                regenerateIdentity: (manager, user) …
Run Code Online (Sandbox Code Playgroud)

c# cookies expired-cookies asp.net-identity

6
推荐指数
1
解决办法
7208
查看次数

标签 统计

asp.net-identity ×1

c# ×1

cookies ×1

expired-cookies ×1