Thread.CurrentThread.CurrentCulture in an ajax method

I am trying to build a simple webpage to test globalization in an AJAX event.

what I have is this:

    [System.Web.Services.WebMethod(EnableSession=true)]
    public static void ChangeCulture(string culture)
    {

        Global.Culture = culture;
        try
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo(Global.Culture);
        }
        catch (Exception)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
        }
        Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    }


where Global.Culture is defined as:

public static class Global
{
    public static string Culture
    {
        get
        {
            if (HttpContext.Current.Request.Cookies["Culture"] == null) return null;
            return HttpContext.Current.Request.Cookies["Culture"].Value;
        }
        set
        {
            if (HttpContext.Current.Response.Cookies["Culture"] == null)
                HttpContext.Current.Response.Cookies.Add(new HttpCookie("Culture", value));
            else HttpContext.Current.Response.Cookies["Culture"].Value = value;
        }
    }
}

now, when I click the button that invokes the method above, the method runs, the cookie is set, the Thread.CurrentThread.CurrentCulture is also set to the correct value. But the next time another ajax method runs, Thread.CurrentThread.CurrentCulture is back to the default en-US.

I should mention my ScriptManager tag looks like this:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnableScriptGlobalization="true" EnableScriptLocalization="true">

what am I missing?
alexp27Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bedanandCommented:
My understanding is each request creates its own thread. so on the next request it creates next thread.

Try saving culture in the session and set threads culture on each reqeust.


Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alexp27Author Commented:
thanks for the answer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.