Setting Culture for ASP.NET MVC application on VS dev server and IIS

Solution 1:

Rather than setting the Thread's culture, you can specify it in the web.config like so:

<configuration>
    <system.web>
        <globalization uiCulture="en-GB" culture="en-GB" />
    </system.web>
</configuration>

That is a more "proper" way of specifying the culture in ASP.NET.

Solution 2:

Well, I didn't actually find what IIS setting is responsible, but I've overridden it in Application_PreRequestHandlerExecute() and it finally worked:

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");

Solution 3:

I think it is a good option to just let the client (i.e. user agent / browser) decide what culture he wants. This can be done by setting the culture and uiCulture attribute of the globalization element in web.config to auto. See "Version 1".

You can also do something like: Take the broswers setting, but if not possbile use en-US as fallback value. See "Version 2".

Version 1:

<configuration>
   <system.web>    
      <globalization culture="auto" uiCulture="auto"/>
   </system.web>
</configuration>

Version 2:

<configuration>
   <system.web>    
       <globalization culture="auto:en-US" uiCulture="auto:en-US" />
   </system.web>
</configuration>


See also this article for more info: Auto Detecting and Setting ASP.NET Locale based on Browser Locale