locked
resources not working in asp.net 4???? RRS feed

  • Question

  • User-558516119 posted

    Hi,

    I have 2 web applications. Both applications have the same resource "configuration":

    App_GlobalResources folder and within it the following resx files: Global.resx, Global.ar-EG.resx, Global.fr-FR.resx, Global.it-IT.resx

    I use the following code to initialize the threads' culture:

    var cult = Request.QueryString["cult"] ?? string.Empty;
              
    //some validation for correct culture format happens here...
    
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo( cult ,true);
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cult , true);
                Culture = UICulture = cult ;


    This works in my first application (.NET 3.5) and when i switch between cultures i get different labels for my controls and all that. I used this method for many websites and web applications... nothing new about it.

    In my .net 4 application I  get ONLY the DEFAULT resx values. I use the exact same code in the exact same places (Page_PreInit) in both applications. Why is it not working?

    (it's driving me nuts!)

    Thanks,

    Eyal

    Tuesday, April 27, 2010 6:50 PM

Answers

  • User-1366948256 posted

    Globalization and Localization has nothing to do with asp.net 4.0. It should some thing else

    Please check your code.

    Cheers,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 28, 2010 2:02 AM

All replies

  • User-1366948256 posted

    Globalization and Localization has nothing to do with asp.net 4.0. It should some thing else

    Please check your code.

    Cheers,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 28, 2010 2:02 AM
  • User-558516119 posted

    I know it has nothing to do with it but that was the only difference between the 2 apps.

    anyway! I changed it and instead of putting it under Page_PreInit I overridden InitializeCulture. That solved it... from now on i'll just use this method because i guess it's the proper one :)

    Thanks,

    Eyal

    Wednesday, April 28, 2010 3:43 AM