'ASP.NET Core 3.1 Session MaxAge is not working

services.AddSession(options =>
{
  options.Cookie.HttpOnly = true;
  options.Cookie.MaxAge = TimeSpan.FromDays(365) <--- 1 year;
  options.Cookie.IsEssential = true;
});

app.UseSession();

in Startup.cs

enter image description here

But, after 30 minutes it will be empty.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source