ASP.NET Core MVC: setting expiration of identity cookie

前端 未结 6 618
死守一世寂寞
死守一世寂寞 2020-12-04 18:15

In my ASP.NET Core MVC app the lifetime of the authentication cookie is set to \'Session\', so it lasts until I close the browser. I use the default authentication scheme fo

6条回答
  •  情书的邮戳
    2020-12-04 18:23

    There's an answer for version 2.0 but it didn't work for me. I had to do:

    services.ConfigureApplicationCookie(options =>
    {
        options.ExpireTimeSpan = TimeSpan.FromDays(30);
    });
    

    The default value is 14 days.

提交回复
热议问题