Application stops generating login cookies

前端 未结 1 504
我寻月下人不归
我寻月下人不归 2021-01-20 06:36

I\'ve been searching for an answer to this for a while but the problem seems quite complex and I\'m struggling to find an answer.

I\'m a beginner software developer

相关标签:
1条回答
  • 2021-01-20 06:39

    Problem is now Solved.

    For anyone with the same problem, the issue is caused by a bug called 'katana bug #197'.

    The easiest fix is to download 'kentor.OwinCookieSaver' NuGet Package. and add app.UseKentorOwinCookieSaver(); above your Application cookie config in startup.

    https://github.com/KentorIT/owin-cookie-saver

     // kentor.OwinCookieSaver for 'katana bug #197' (login cookies being destroyed on logout!)
                app.UseKentorOwinCookieSaver();
                app.UseCookieAuthentication(new CookieAuthenticationOptions
                {
                    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                    CookieName="LoginCookie",
                    LoginPath = new PathString("/Login/Login"),
                    Provider = new CookieAuthenticationProvider
                    {
                        OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                            validateInterval: TimeSpan.FromMinutes(30),
                            regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                    }
                });
    

    Microsoft are aware of the issue and it will be resolved in 2015.

    0 讨论(0)
提交回复
热议问题