NeedACar
NeedACar

Reputation: 951

ASP.NET MVC CurrentCulture, from user or server?

Quick question that I couldn't find a clear answer on, if I get the CurrentCulture of a thread in an MVC application, is this the culture based on the user's browser/OS, or the culture that is set on the server?

Thanks

Upvotes: 1

Views: 1518

Answers (1)

haim770
haim770

Reputation: 49123

If you enabled enableClientBasedCulture in your Web.Config:

<system.web>
    <globalization enableClientBasedCulture="true" />
</system.web>

Then client culture will be used, otherwise it will use the server culture.

You can also set a fallback culture in case the client didn't send the AcceptLanguage header, by setting the culture and uiCulture properties as well:

<globalization enableClientBasedCulture="true" culture="en-US" uiCulture="en-US" />

See MSDN

Upvotes: 3

Related Questions