using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using Weee.Service; using Resources.Helper; using System.Threading; using Weee.Controllers; using Weee.DAL; using CScommon; namespace Weee.Areas.Certification.Controllers { [Authorize(Roles = ProgramConstants.certification)] public class CertificationControllerBase : QcarbonControllerBase { public CertificationControllerBase(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); } } }