简体   繁体   中英

ASP.NET : Globalization error

I've a problem with serialization both in silverlight and asp.net.

I've added this line to my web.config to set the culture of my web application:

<globalization uiCulture="fr-CA" culture="fr-CA"/> 

Problem: when my computer is set to another culture for example en-UK, my application is taking that culture instead of the one i set in the web.config.

Your site might be honoring the browser's stated language preference.

Check the Language settings in the browser, and try setting enableClientBasedCulture in your web.config to false , per this MSDN article .

Also worth making sure you try other basic troubleshooting steps, like resetting IIS (assuming you're not using the built-in Visual Studio development web server).

If those steps fail, I would roll up my sleeves and try some serious debugging. It's possible something else is overriding your setting, or that ASP.NET isn't finding your .resx resource file.

Try overriding the InitializeCulture method on a page and hardcoding the language there (assuming you're using Webforms). That will also let you set a breakpoint while the page is loading and check what the UICulture is set to.

If the cultures are getting set properly, I'd look to make sure everything is set up correctly with your .resx . Those things can be a pain to get configured in my experience.

It might be a good idea to set up a simple HelloWorld demo app to try to reproduce and isolate the problem. Here's a decent walk-through so you can check your setup steps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM