Logging out after a few minutes despite authentication in Owin

Nov 1 2020 3:04 AM
I use owin and although I have set the expired time defined in Startup.cs as 1 day, it exits itself after 15 minutes when the site is open in browser.Besides, when I run it on my localhost, I do not encounter such a problem.When I right click and look at the cookies in the applications, the expires actually looks correct.application />cookies
 
 
  1. app.UseCookieAuthentication(new CookieAuthenticationOptions  
  2. {  
  3. ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter,  
  4. ExpireTimeSpan = TimeSpan.FromDays(1),  
  5. SlidingExpiration = true,  
  6. CookieHttpOnly = true,  
  7. AuthenticationType = "Cookie",  
  8. LoginPath = new PathString("/Admin/Login"),  
  9. Provider = new CookieAuthenticationProvider  
  10. {  
  11. OnResponseSignIn = context =>  
  12. {  
  13. context.Properties.AllowRefresh = true;  
  14. context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(1);  
  15. }  
  16. }  
  17. });  
  18. app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);  
My sign in function is as follows,
  1. var claims = new Claim[]  
  2. {  
  3. new Claim(ClaimTypes.NameIdentifier,model.id),  
  4. new Claim(ClaimTypes.Name,model.username),  
  5. new Claim(ClaimTypes.Role,"Admin")  
  6. };  
  7. var identity = new ClaimsIdentity(claims, "Cookie");  
  8. Authentication.SignIn(new AuthenticationProperties() { ExpiresUtc = DateTime.UtcNow.AddDays(1), IsPersistent = true }, identity);