ASP.NET Core cookie not working on the real host

68 Views Asked by At

I've created website with ASP.NET Core 7 MVC. I set my sign in user cookie in program.cs file for 24 hours as seen in this code:

builder.Services.ConfigureApplicationCookie(options =>
{
    options.AccessDeniedPath = "/Home/Index";
    options.Cookie.Name = "WebAppIdentityCookie";
    options.Cookie.HttpOnly = true;
    options.ExpireTimeSpan = TimeSpan.FromHours(24);
    options.LoginPath = "/Sign";
    options.SlidingExpiration = true;
});

The cookie worked correctly in debug mode, and it also worked correctly on publish for localhost on my Windows IIS. But when I put in on a real host, the cookie remains valid for only 5 minutes.

I try another value for days, minutes and etc. but nothing changes.

How can I fix this? Please help.

0

There are 0 best solutions below