0

I would like to set never expired for my asp.net core identity. How can I do that? The code as below...

         services.ConfigureApplicationCookie(options =>
        {
            options.Cookie.Name = ".AspNetCore.Identity.Application";
            options.ExpireTimeSpan = TimeSpan.FromDays(30);
        });
  • What version of .net core you use, maybe you can set the time very long, you can read this post, maybe it will be helpful to you: https://stackoverflow.com/questions/34979680/asp-net- core-mvc-setting-expiration-of-identity-cookie/34981457 – Tupac Oct 08 '21 at 06:53

1 Answers1

0

How about using TimeSpan.MaxValue. It is approximately 20 000 years, which seems long enough...

This bigger question is why do you want this. Are you maybe looking for the SlidingExpiration property? Which will "re-issue a new cookie with a new expiration time any time it processes a request which is more than halfway through the expiration window"?

JHBonarius
  • 10,824
  • 3
  • 22
  • 41