fixed culture cookie missing attributes like samesite

This commit is contained in:
Mia Rose Winter 2024-01-24 11:58:48 +01:00
parent 1223b7f428
commit d40e74307f
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
2 changed files with 10 additions and 2 deletions

View file

@ -52,6 +52,10 @@
CookieRequestCultureProvider.MakeCookieValue(
new RequestCulture(
CultureInfo.CurrentCulture,
CultureInfo.CurrentUICulture)));
CultureInfo.CurrentUICulture)), new CookieOptions {
Expires = DateTimeOffset.UtcNow.AddYears(1),
IsEssential = true,
SameSite = SameSiteMode.Strict
});
}
}

View file

@ -11,7 +11,11 @@ public class LanguageController : ControllerBase {
Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
new CookieOptions {
Expires = DateTimeOffset.UtcNow.AddYears(1),
IsEssential = true,
SameSite = SameSiteMode.Strict
}
);
return LocalRedirect(string.IsNullOrWhiteSpace(returnUrl) ? "/" : returnUrl);