my problem is I can not set sliding expiration configuration for session.
The Identity Cookie is sliding and not expiring while using the Application but the session not sliding, after IIS session timeout, the session is renewing itself and my session data is cleared.
Here is my startup code:
public void ConfigureServices(IServiceCollection services)
{
// some other configurations..
services.ConfigureApplicationCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromHours(6);
options.LoginPath = "/Auth/Login";
options.AccessDeniedPath = "/Dashboard";
options.LogoutPath = "/Auth/Logout";
options.SlidingExpiration = true;
options.Cookie.IsEssential = true;
});
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromHours(6);
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
}
How to set sliding expiration property to session's cookie?