title: CurrentThread.CurrentUICulture is set correctly but get always en-US
body: <p>I am working on a multilingual website with two languages to start with Arabic and English</p>
  
  <p>I have set language to Arabic (ar-ae) in IE and also on FireFox but it always get me the English version i am not able to troubleshoot this issue</p>
  
  <p>Site Structure</p>
  
  <pre><code>Default.aspx
   en/Default.aspx
   ar/Default.aspx
  </code></pre>
  
  <p>Problem is that when i use URL as <code>http://localhost:49831/site/Defualt.aspx</code> Then it works fine and redirects me to Arabic version <code>ar/Default.aspx</code> if Arabic is selected as language. </p>
  
  <p>But when is use URL as <code>http://localhost:49831/site/</code>  then it always redirect me to English version  <code>en/Default.aspx</code></p>
  
  <p>I am not sure what i am doing wrong.</p>
  
  <p>I use Default.aspx only to detect the default browser language and then redirect accordingly</p>
  
  <p>CODE for  Default.aspx.cs file</p>
  
  <pre><code>    // Localization and Globalization code
      protected override void InitializeCulture()
      {
          String lang = Request["Language"];
  
          Session["lang"] = Helper.DetectLanguage(lang);
          //Set Direction of page LTR/RTL
          if (Session["lang"] == "ar-AE")
          {
              Session["PageDIR"] = "rtl";
          }
          else
          {
              Session["PageDIR"] = "ltr";
          }
  
          base.InitializeCulture();
      }
  
     public static String DetectLanguage(String lang)
      {
          String LangCode = lang;
  
          if (!string.IsNullOrEmpty(lang))
          {
              lang =  lang.ToLower();
          }
  
          String Lang2Char;
         CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture;
          String LangName = ci.Name.ToString().ToLower();
          //check leng &amp; if length is less than 2 then set english as default language.
          if (LangName.Length &gt; 1)
          {
               Lang2Char = LangName.Substring(0, 2);
          }
          else
          {
               Lang2Char = "en";
          }
  
          // if QueryString is not null then execute foollowinf if block
          //If Language is present in Querystring then excute if part else, else part
          if (lang != null)
          {
              switch (lang)
              {
                  case "en-us":
                      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                      Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                      LangCode = "en-US";
                      break;
                  case "ar-ae":
                      Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-AE");
                      Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-AE");
                      LangCode = "ar-AE";
                      break;
                  default:
                      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                      Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                      LangCode = "en-US";
                      break;
              }
          }
          // if lang query string is null then set the language based on following logic
          else
          {
              switch (Lang2Char)
              {
                  case "en":
                          Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                          Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                          LangCode = "en-US";
                          break;
                  case "ar":
                          Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-AE");
                          Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-AE");
                          LangCode = "ar-AE";
                          break;
                  default:
                          Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                          Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                          LangCode = "en-US";
                          break;
              }
  
          }
          return LangCode;
      }
  </code></pre>
  
  <p>How can i best define this code so that it works. Is it better to define CurrentUICulture  in Global.asx file</p>