views:

9

answers:

0

Not sure if I am doing correct. Would this cause performance issues since it runs on every request? Thanks.

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            string culture = "en-US";
            HttpCookie cookie = Request.Cookies["culture"];
            if (cookie != null && cookie.Value != null)
                culture = cookie.Value;

            CultureInfo ci = new CultureInfo(culture);
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            System.Threading.Thread.CurrentThread.CurrentCulture =
                CultureInfo.CreateSpecificCulture(ci.Name);
        }