Ensures the culture is set for requests for both front-end and back office

This commit is contained in:
Shannon
2021-01-08 11:29:07 +11:00
parent b4922d2685
commit c15b416e88
10 changed files with 94 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Serilog.Context;
@@ -57,9 +58,10 @@ namespace Umbraco.Extensions
// where we need to have UseAuthentication and UseAuthorization proceeding this call but before
// endpoints are defined.
app.UseRouting();
app.UseRequestLocalization();
app.UseAuthentication();
app.UseAuthorization();
// This must come after auth because the culture is based on the auth'd user
app.UseRequestLocalization();
// Must be called after UseRouting and before UseEndpoints
app.UseSession();