Where is an ASP.NET Thread's Culture Initially Set?

Last post 01-08-2008 12:06 PM by JRumerman. 2 replies.

Sort Posts:

  • Where is an ASP.NET Thread's Culture Initially Set?

    01-07-2008, 11:04 PM
    • Member
      585 point Member
    • JRumerman
    • Member since 03-01-2006, 6:26 PM
    • San Diego, CA
    • Posts 140

    Hi Everyone,


    I was wondering if anybody knew where an ASP.NET thread's culture was initially set. Where is Accept-Language: en-US translated to the Culture Info assigned to the running thread?

    At first I thought it was going to be somewhere in the Page class, but that is obviously too limiting (what about web services?). I followed the little white rabbit into WebHeaderCollection and UnsafeNclNativeMethods, but I've lost sight of the rabbit.

    Anybody already figured this one out?

    Thx, Joel 

  • Re: Where is an ASP.NET Thread's Culture Initially Set?

    01-08-2008, 2:34 AM
    • All-Star
      17,710 point All-Star
    • vivek_iit
    • Member since 06-18-2006, 6:13 PM
    • New Delhi
    • Posts 3,171
    • TrustedFriends-MVPs

    Hi Joel,

    If the page culture is set to auto, then the Initilaizeculture() method fires and sets the culture as per the browser setting. Else we can also overload this method and set culture accordingly. Yo may want to look at this post:

    http://forums.asp.net/t/884482.aspx

    Hope this helps,

    Vivek

  • Re: Where is an ASP.NET Thread's Culture Initially Set?

    01-08-2008, 12:06 PM
    • Member
      585 point Member
    • JRumerman
    • Member since 03-01-2006, 6:26 PM
    • San Diego, CA
    • Posts 140

    Hi Vivek (and everyone else),

    That is what I initially guessed, but that's not the case. Here's the reflected code from the InitializeCulture method on the Page object:
     

    protected virtual void InitializeCulture()
    {
    }

    It seems that the InitializeCulture method is where we can override the culture, but it's not where it's initially set. I'm looking for the location where the header value Accept-Language is read and processed automatically.


    I read through the post that you pointed me at and I don't think its listed in their either.


    Thx, Joel 

Page 1 of 1 (3 items)