Why Thread.CurrentThread.CurrentCulture.Name showing "en-US" when English is installed for my regional server language (UK)

I have a web application that at different points forces users to enter dates as well as display dates for users. When debugging (and when the site is running on our test and intermediate servers), date formats are displayed in the format dd / mm / yyyy (when using DateTime.ToShortDateString ()). These servers (and my development environment have "English (United Kingdom)", which are installed as the language under the regional versions of Windows. Everything is fine. So far, the live server dates are displayed in mm / dd / yyyy format, even if the live server is - still has the language β€œEnglish (United Kindgom).” I saw this question explaining how to parse a date in a specific format, and I already know how to get the date in the format of the requested string ( DateTime.ToString("dd/MM/yyyy") ), but I'm curious that another OS setting on a real server is called Isn't this a mismatch ? I also saw this question , but it doesn't seem to answer my question.

Additional information: in test and intermediate environments System.Threading.Thread.CurrentThread.CurrentUICulture.Name = "EN-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name = "EN-RU"

And in the living environment, System.Threading.Thread.CurrentThread.CurrentUICulture.Name = "EN-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name = "EN-US"

+4
source share
4 answers

Have you checked the globalization web.config section?

You can install it declaratively like this:

  <globalization uiCulture="en-GB" culture="en-GB" /> 

See: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx

+6
source

Regional settings are applied for each user, so you need to make sure that you change the regional settings for which IIS user launches your application, for example, Network Service.

Many others seem to be looking for ways to do this (google "IIS change locale"). It seems that most people achieve this by hacking the settings in the corresponding part of the registry (under HKEY_USERS\IUSR-SID\Control Panel\International )

+2
source

You can, of course, override this in the Begin Request event.

But the real main reason is that Windows is not localized in English. We get American English: there is no localization of resources for en-GB, so this parameter avoids many unsuccessful requests for en-GB resources that immediately return to en-US.

+1
source

Try checking the locale used on the real server. check the link below for more details

http://www.java.com/en/download/help/locale.xml

You may also need to check the priority of the language specified in the browser.

Yours faithfully

-3
source

All Articles