Last post Jan 05, 2009 09:29 PM by Nai-Dong Jin - MSFT
Jan 02, 2009 12:27 PM|PProgrammer|LINK
What could be the reason, why CultureInfo.CurrentCulture.ToString() is wrong?
The web.config contains no specifications concerning the culture.
The string should contain "fr-CH" but it contains "de-CH".
Testing CultureInfo.CurrentCulture.ToString() with a new small test-webapp, the culture is correct on the same computer.
Thanks for your input.
Jan 02, 2009 12:34 PM|MetalAsp.Net|LINK
Could this be coming from whatever it's set to on the computer, or possibly in Internet Explorer.
Jan 02, 2009 12:51 PM|PProgrammer|LINK
the computers culture was not changed before testing with the second test-application.
And I didn't touch Internet Explorer setting before testing with the second application.
For this reason the culture should be the same, I think.
Now I just tested in Firefox, which shows the same wrong culture.
Jan 02, 2009 01:11 PM|MetalAsp.Net|LINK
I believe, there's a way to specify the "default" culture in the web.config. That is, if the culture resource file is not found then use this setting sort of thing. Don't know if that's any help...
Jan 02, 2009 03:21 PM|PProgrammer|LINK
I've got some news to add:
The culture is correct, when I have a local webpage in the filesystem, testing with the local ASP.NET Development Server.
As soon as I load the same page to a remote server (IIS 6 on Windows 2003) the culture is wrong.
Since a webserver can publish one webpage to multiple clients which have multiple cultures, I believe, that the culture depends on the client, yes?
What do I have to change to have a remote webpage displaying the correct cultures on all clients?
Thanks for your help.
Jan 03, 2009 08:07 AM|MetalAsp.Net|LINK
I believe that the culture is set on the client computer, absolutely. I don't know that I have an answer to your second question, sorry.
Jan 05, 2009 09:29 PM|Nai-Dong Jin - MSFT|LINK
It seems that the changes occurs because of the different settings in browsers. As we know,users can set the UI culture and culture in their browsers. For example, in Microsoft Internet Explorer, on the Tools menu, users can click Internet Options, on the
General tab, click Language, and then set their language preference.If the enableClientBasedCulture attribute of the globalization element in the Web.config file is set to true, ASP.NET can set the UI culture and culture for a Web page automatically, based
on the values that are sent by a browser.
But generally, it is not a best practice to rely exclusively on browser settings to determine the culture. You should provide a method for users to explicitly choose a language or language and culture. You can set the culture and UI culture for an ASP.NET
web page declaratively or set them programmatically.
For details on how to achieve that, see: