services.ConfigureApplicationCookie(...):
services.ConfigureApplicationCookie(options =>
{
options.Cookie.Name = "sessionCookie";
options.Cookie.HttpOnly = true;
options.Cookie.SameSite = SameSiteMode.Lax;
options.Cookie.MaxAge = TimeSpan.FromHours(5);
options.SlidingExpiration = true;
options.LogoutPath = $"/SignOut";
options.AccessDeniedPath = $"/Account/AccessDenied";
});
IdentityUser
:services.AddDefaultIdentity<ApplicationUser>()
.AddDefaultUI()
.AddRoles<ApplicationRole>()
.AddEntityFrameworkStores<AppIdentityDbContext>();
The problem was the following line of code which came way before the lines shown in the question:
services.AddCookieConfiguration();
This was an method with return type IServiceCollection
, which was written by another developer a few months ago. Because of this "error" I realized how messy our Startup.cs
actually is and extracted some configurations into their own methods.