not enough information. maybe the site is recycling.
use the browser tools to track the if the cookie is sent.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello there.
I have a web application running using .NET 5.0 and Razor pages that keeps logging me out every 1-2 minutes on my production environment. The same app, runinng local doesn't do that.
I have cookies configured on my startup.cs file like this:
services.AddDefaultIdentity<Usuario>(options =>
{
options.SignIn.RequireConfirmedAccount = false;
options.Password.RequiredLength = 8;
options.Password.RequiredUniqueChars = 3;
options.Password.RequireDigit = false;
options.Password.RequireNonAlphanumeric = false;
options.Password.RequireUppercase = false;
options.Password.RequireLowercase = false;
})
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/Admin");
options.Conventions.AuthorizeFolder("/Fotografo");
});
services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
services.ConfigureApplicationCookie(options =>
{
options.Cookie.Name = "user_site";
options.LoginPath = "/Login";
options.ExpireTimeSpan = TimeSpan.FromMinutes(60);
options.SlidingExpiration = true;
options.ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter;
});
And as you can see on the attached image, the cookie is correctly set in the website
The problem happens when I log in in the /Admin folder, then after a few minutes I try to access another page inside the same folder, the app will redirect me to the login page with the page that I tried to access as a ReturnURL parameter. On my local environment this doesn't happen, only on the production. Could you help me to identify why this happens and how could I fix it?
Thank you very much.
not enough information. maybe the site is recycling.
use the browser tools to track the if the cookie is sent.