locked
what id default culture for ASP.NET and how it is set up? RRS feed

  • Question

  • User-163593222 posted

    When I got framework installed into sytem, the locale for my xp was ru-Ru.

    The test asp.net page said the same (System.Globalization.CultureInfo.CurrentCulture.ToString()). But when I got xp locale changed to en-US, the test page still said "ru-RU".

    Now I have to set locale for each application in web.config file as the default ASP.NET locale says "ru-RU".

    It seems like the framework saves somewhere the locale of XP at moment of installation, and the any changes of xp locale doesn't affect the ASP.NET.

     

    is possible to configure frameworks config files to use specified locale as default?

    thanks. 



     

    Wednesday, March 28, 2007 8:41 AM

Answers

  • User-512273051 posted

    Is possible to configure frameworks config files to use specified locale as default?

    thanks. 

     

    Yes, you see asp.net save all the  global information in machine.config file which you can find here  C:\WinNT\Microsoft.NET\Framework\v.1.00\config\machine.config  //v.1.00 is framework version you might have some thing else.

    Furthermore, just do the following changes
    <configuration>  <system.web>  <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="de-DE" />  </system.web> </configuration>

    If you dont want your web.config to replace this configuration setting just add allowOverride="false" in <globalization>

     

    cheers. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 28, 2007 9:11 AM

All replies

  • User1283991206 posted

    Hi,

    you can setup the globalization for each ASP.NET application with the web.config, e.g.:

    <configuration>
      <system.web>
        <globalization culture="de-DE" uiCulture="de-DE" />
        ....

    Regards
    Marc André

     

    Wednesday, March 28, 2007 9:04 AM
  • User-512273051 posted

    Is possible to configure frameworks config files to use specified locale as default?

    thanks. 

     

    Yes, you see asp.net save all the  global information in machine.config file which you can find here  C:\WinNT\Microsoft.NET\Framework\v.1.00\config\machine.config  //v.1.00 is framework version you might have some thing else.

    Furthermore, just do the following changes
    <configuration>  <system.web>  <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="de-DE" />  </system.web> </configuration>

    If you dont want your web.config to replace this configuration setting just add allowOverride="false" in <globalization>

     

    cheers. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 28, 2007 9:11 AM
  • User-163593222 posted

    thanks, but I know about this, I would like to set default culture for entire framework, not for each application.

    The question is where the framework holds default setting for culture. I mean that there should be some entry the hold the default culture.

    The way of yours just configure application instance on IIS.


     

    Wednesday, March 28, 2007 9:15 AM
  • User-512273051 posted

    I guess you have not read my above post, let me mention again. global configuration is stored in app.config file. which is stored in
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG (.net 2.0)

     

    cheers 

    Wednesday, March 28, 2007 9:22 AM
  • User-163593222 posted

    thanks, but I know what is machine.config for the framework.

    And before to start this thread I checked for "ru-Ru" culture in all framework's configs, and I found nothing that could refer to "ru-Ru" culture.

    And I have no idea how to force framework to use "en-US" culture by default, I mean without any extra modification such modifing the web.config file for app instance in IIS.


     

    Wednesday, March 28, 2007 9:27 AM
  • User-512273051 posted

    have you write those lines which are in my first post in your machine.config

    cheers 

    Wednesday, March 28, 2007 9:38 AM
  • User-163593222 posted

    hi, huge thank you, I was in hurry and accedently ignored your first post.

    It helped me much.

    But I also have another issue, may be you could help me.

    is it possible to set culture for win Service by .NET via config file?

    thanks.

     

     

     

    Wednesday, March 28, 2007 10:17 AM
  • User877999272 posted

    Greetings all,

    I've run into the same issue where changing the locale has no effect on asp.net and was curious where the default is. I am aware of the config system and how to set the localization globally on a machine, but what I really, really want to know is where is the default coming from in the first place? Here's where the confusion is coming from:

    1. Install a windows server 2003 system with defaults for the US.
    2. In a console app, the currentculture comes out as en-US.
    3. In an aspx page, the currentculture comes out as en-US.
    4. In Control Panel -> Regional and Language Options -> Standards and formats, set the format to English (United Kingdom) and hit apply.
    5. Rerun the console app, the currentculture comes out as en-GB.
    6. Rerun the aspx page, the currentculture comes out as en-US, not en-GB!!!

    Changes to the locale seem to take just fine in a standard process, but asp.net seems to be holding on to the original system default locale!

    I know that I can change it in the root web.config file, but I really want to understand where that original default is getting held onto such that it becomes necessary to change the root web.config file in order for it to take effect. Looking at the System.Web.Configuration.GlobalizationSection class in Reflector, the values for Cutlure and UICulture are set to an empty string if that section isn't defined anywhere....so where do "" get translated into the orignally installed locale???

    Thanks in advance,
    John

    Tuesday, April 17, 2007 1:19 PM
  • User1253018307 posted
    Hi John
    It seams that the culture is coming from the ASPNET account. What i can remember so have the aspnet process always inherits its "runas" accounts culture. But since some update (framework?) this is changed and the asp.net is now always reading the default from ASPNET account.
    And ASPNET earns its culture from the .DEFAULT "user" in registry that is created when the computer/server was installed.
    Go find the correct "user" Sid to change in registry you can use PSTools getusersid and type
    getusersid aspnet
    Best reg
    Johan
    Tuesday, January 20, 2009 9:19 AM
  • User1677479917 posted

    Hello Guys,

    After Investing -- 8 hours and pulling my hairs. Found solution:

    It turns out that regional settings are stored per user in Windows. This is something I should have been aware of. Updating the application pool to run as myself produced the same result across both applications.

    To be fair, what is still confusing is how Network Service (the account the application pool was running under) came to have the incorrect value. I'm not even sure how I'd rectify that.

    Edit:

    If you need to update the regional settings for reserved accounts. You have two options.

    1. Control Panel > Regional Settings > Click the administrative tab and then select "Copy Settings". On the screen that launches, ensure you check "Welcome Screen and system accounts". Older versions of Windows are similar I believe.
    2. For the brace. Registry: HKEY_USERS > SID... > Control Panel > International. The security identifier for Network Service is: SID: S-1-5-20.

    Ensure you restart the application pool for settings to take effect.

    Source : http://stackoverflow.com/questions/14322910/cultureinfo-values-differ-between-applications-for-the-same-culture-is-this-a-b/14323336#14323336

    I did step#1 -- and it worked for me! It may help you!

    Monday, September 16, 2013 10:56 AM