I am using cookie authentication middleware for authenticate users in asp.core web application. Following are the lines of code which i am setting in "Startup.cs" class:
app.UseCookieAuthentication(new CookieAuthenticationOptions() { AuthenticationScheme = "CookieAuthentication", LoginPath = new Microsoft.AspNetCore.Http.PathString("/Login/Index/"), AccessDeniedPath = new Microsoft.AspNetCore.Http.PathString("/Login/Denied/"), ExpireTimeSpan = TimeSpan.FromSeconds(300), SlidingExpiration = true, AutomaticAuthenticate = true, AutomaticChallenge = true });
As described in above code lines, I have set 5 min of cookie expire time span. Now, if i signed-In into web application at the time span 05:00:00. So, the expiration time of authentication cookie will be at 05:05:00. After that i am sending a second request at the time span 05:03:00. So, the expiration time of authentication cookie must be extend and will be 05:08:00. But, if user try to send a another request at 05:06:00 then he/she is redirected onto login screen back.
Please provide me a appropriate solution if any. Here help would be more appreciated.
~Ashish Bhalodiya