Quote:
i set the idle timeout for 2 minutes, ... then the session getting expired in 2 minutes
It's doing exactly what you told it to do! You said expire the session in 2 minutes, so the session is expiring in 2 minutes. What did you think was going on?
From your own code:
builder.Services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromMinutes(2); <---- Here's your 2 minute timeout.
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
If the user doesn't request a new page inside of 2 minutes, the session times out.