ASP.NET Culture Code Global Setting in Web.config

In often cases, I don’t usually pay attention to the culture. This has come back to bite me time after time 🙂

The problem exists when your done the dev phase and moving your web application to another machine, that machines culture code settings may have different defaults than your dev box did. The simple solution is just to set it in your web.config for your site. This way you guarantee the culture code is the same wherever your host your website.

Here is the one line of markup you need in your web.config (goes anywhere inside the system.web node):

  1. <globalization culture="en-CA" uiCulture="en-CA" />

And thats it. Of course you can adjust the codes for your nature. In often cases that will be “en-US” for North America.

2 Comments

  1. sqda says:

    The culture depends on the codes for pages defined by National Langua Support. For a complete list of available FORMATs for time, date, currency, number in each country see http://msdn.microsoft.com/en-us/goglobal/bb896001

  2. sqda says:

    you can change friendly the formats for currency, number, date, time depending on countries you can see a list of codes for National Language Support in http://msdn.microsoft.com/en-us/goglobal/bb896001.
    In my case I used Latin American format (dd/mm/yyyy) but I need dates format to US (mm/dd/yyyy) to do this I just set the web.config globalization section as

Leave a Reply