locked
Localization Problems with HttpContext.Current.Request.UserLanguages. RRS feed

  • Question

  • User-299146519 posted

    I am having problems with localization.  I am trying to use HttpContext.Current.Request.UserLanguages.  With a bare-bones page, when I get to a page the first time, this collection has a length of one and is showing en-us.  When I refresh the page, I get the complete list of languages in my browser.  This only happens with IE, not FF.

    Any ideas?

     

    Tuesday, May 4, 2010 1:54 AM

Answers

  • User-1636183269 posted

    Genally such problem occur when you are setting some value from code in web.config, so it is developer fault, check in you codeanything are you setting in web.config like langauge, culture etc. So due to thsi your application restart due to this happening. Just find your code.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 4, 2010 4:50 AM
  • User-299146519 posted

    It turns out that there is a problem with IE and Languages. 

    The frustrating thing is that this was not working a few weeks ago.  When it worked today,  I had only 3 languages in my browser since I needed to test something. 

    When this was not working, I had about 24 set in my browser since my site is localized in all those languages.  To see if there is some problem with IE and the amount of languages, I added all 24 back in and sure enough they do not show up when I first load the page. I kept lowering the count until I had 7 and then it worked.  I do not know if it is the count of languages or the type.  I tried with a combination of single and double-byte languages and it still errors at 8. 

    I know someone at Microsoft and that has been reported to the IE team.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 21, 2010 4:49 PM

All replies

  • User-1636183269 posted

    Genally such problem occur when you are setting some value from code in web.config, so it is developer fault, check in you codeanything are you setting in web.config like langauge, culture etc. So due to thsi your application restart due to this happening. Just find your code.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 4, 2010 4:50 AM
  • User-299146519 posted

    I do not see any setting for culture or language in web.config at all.  Any idea where to look?

    I created a barebone site with one page and the default web.config and it still fails.

    The odd thing is that if I go to the url from a favorite in the browser, it works fine.  If I access the link from the history drop down it works fine. 

    If I access the link from an email in Outlook, it fails and only shows en-us. 

    Tuesday, May 4, 2010 11:24 AM
  • User-1636183269 posted

    Do one thing just send me part of the code in which you are setting culture based on changed language. 

    Tuesday, May 4, 2010 8:53 PM
  • User-299146519 posted

    Here is the only code I have in my test page.

      protected void Page_Load(object sender, EventArgs e)
        {

            string[] languages = HttpContext.Current.Request.UserLanguages;
            for (int j = 0; j < languages.Length; j++)
            {
                Response.Write(languages[j] + ",");
            }

        }


    I have a whole set of languages in my settings that I use.  When the page loads from a link in en email, it only returns en-us.  When I refresh, it lists the entire set of languages.

     

     

     

    Wednesday, May 5, 2010 10:59 AM
  • User-299146519 posted

    It turns out that there is a problem with IE and Languages. 

    The frustrating thing is that this was not working a few weeks ago.  When it worked today,  I had only 3 languages in my browser since I needed to test something. 

    When this was not working, I had about 24 set in my browser since my site is localized in all those languages.  To see if there is some problem with IE and the amount of languages, I added all 24 back in and sure enough they do not show up when I first load the page. I kept lowering the count until I had 7 and then it worked.  I do not know if it is the count of languages or the type.  I tried with a combination of single and double-byte languages and it still errors at 8. 

    I know someone at Microsoft and that has been reported to the IE team.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 21, 2010 4:49 PM