Skip to main content

ASP.NET Core–Set default request Culture

ASP.NET Core comes with built-in localization features through the Localization middleware. This middleware will update the current Culture and current UI Culture based on information provided by one or more 'RequestCultureProviders'

The default providers are

  • QueryStringRequestCultureProvider
  • CookieRequestCultureProvider
  • AcceptLanguageHeaderRequestCultureProvider

It is also possible to set a default culture when no culture information could be resolved through one of the configured providers. This is useful if your website or application targets a standard audience in one region or country.

To set a default culture, we need to configure  the DefaultRequestCulture property of the RequestLocalizationOptions:

Now when no culture information could be resolved through one the providers, 'nl-BE' will be used as our default culture.