Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cookie Authentication Middleware does not extending a session time on each request

$
0
0

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


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>