using CScommon; using Resources.Helper; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Web; using System.Web.Mvc; using Weee.Controllers; using Weee.DAL; namespace Weee.Areas.Lca.Controllers { [Authorize(Roles = ProgramConstants.normalcompany)] public class LCAcontrollerBase : QcarbonControllerBase { public LCAcontrollerBase(WeeeDataContext db) : base(db) { } protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state) { string cultureName = null; // Attempt to read the culture cookie from Request HttpCookie cultureCookie = Request.Cookies["_culture"]; if (cultureCookie != null) cultureName = cultureCookie.Value; else cultureName = Request.UserLanguages != null && Request.UserLanguages.Length > 0 ? Request.UserLanguages[0] : null; // obtain it from HTTP header AcceptLanguages // Validate culture name cultureName = CultureHelper.GetImplementedCulture(cultureName); // This is safe // Modify current thread's cultures Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; return base.BeginExecuteCore(callback, state); } } }