none
Culture in Custom LogInpage RRS feed

  • Question

  • Hello,

    •   I have create a custom Login Page by using  Application Page .
    • I use Three Resource file (Registeration.ar-SA  && Registeration.en-US && Registeration )
    • I have Two site collection ( Araic : ar-SA  & English : en-US ) .
    • I try Open the custom login page from two site collection . it always read from deafault resource file "Registeration.resx"
    • I write the following line in the page Load :

                 string value = Thread.CurrentThread.CurrentCulture.Name .

                  And it always return "ar-EG" .

                 How Can I solve this?


    ASk
    Sunday, October 9, 2011 1:45 PM

Answers

  • Hi ,

    check this thread

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/5bc450e4-3dc9-4c8c-b9df-8eca1ff5946e/


    Regards, Fadi Abdulwahab. http://sqlgoogler.blogspot.com/ Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
    • Marked as answer by himo Sunday, October 9, 2011 9:45 PM
    Sunday, October 9, 2011 2:32 PM
  • Hi,
    If you can pass the culture name with log in page as query string and then in page load event you can change the culture based on query string
    <script>
     protected void Page_Load(object sender, EventArgs e)
        {
            this.Culture = Request["Culture"];
            this.UICulture = Request["Culture"];
        }
    </script>
    Regards, Fadi Abdulwahab. http://sqlgoogler.blogspot.com/ Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
    • Marked as answer by himo Sunday, October 9, 2011 9:45 PM
    Sunday, October 9, 2011 8:07 PM

All replies

  • Hi ,

    check this thread

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/5bc450e4-3dc9-4c8c-b9df-8eca1ff5946e/


    Regards, Fadi Abdulwahab. http://sqlgoogler.blogspot.com/ Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
    • Marked as answer by himo Sunday, October 9, 2011 9:45 PM
    Sunday, October 9, 2011 2:32 PM
  • Hello ,

    Thanks for ur reply ,

     I have used the following code :

    string acceptLang = Request.Headers["Accept-Language"];//it should be like the following string :en-US,zh-CN;q=0.5
    string defaultLang = acceptLang.Split(';')[0].Split(',')[0];

    Then you can set the culture with the following code.

    CultureInfo culture_object = new CultureInfo(defaultLang);   
    System.Threading.Thread.CurrentThread.CurrentCulture = culture_object;
    System.Threading.Thread.CurrentThread.CurrentUICulture = culture_object;

    the "defaultLang" always returns 'en-us'  although I open it from arabic site collection .


    ASk
    Sunday, October 9, 2011 2:57 PM
  • Hi,
    If you can pass the culture name with log in page as query string and then in page load event you can change the culture based on query string
    <script>
     protected void Page_Load(object sender, EventArgs e)
        {
            this.Culture = Request["Culture"];
            this.UICulture = Request["Culture"];
        }
    </script>
    Regards, Fadi Abdulwahab. http://sqlgoogler.blogspot.com/ Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you
    • Marked as answer by himo Sunday, October 9, 2011 9:45 PM
    Sunday, October 9, 2011 8:07 PM