Global.asax.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.Web.Optimization;
  7. using System.Web.Routing;
  8. namespace NEducation
  9. {
  10. public class MvcApplication : System.Web.HttpApplication
  11. {
  12. protected void Application_Start()
  13. {
  14. AreaRegistration.RegisterAllAreas();
  15. FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  16. RouteConfig.RegisterRoutes(RouteTable.Routes);
  17. BundleConfig.RegisterBundles(BundleTable.Bundles);
  18. log4net.Config.XmlConfigurator.Configure();
  19. }
  20. protected void Application_BeginRequest(object sender, EventArgs e)
  21. {
  22. HttpCookie cookie = HttpContext.Current.Request.Cookies["Language"];
  23. if (cookie != null && cookie.Value != null)
  24. {
  25. System.Diagnostics.Debug.WriteLine("cookie: " + cookie.Value);
  26. System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cookie.Value);
  27. System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cookie.Value);
  28. }
  29. else
  30. {
  31. System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("km");
  32. System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("km");
  33. }
  34. }
  35. }
  36. }