コード例 #1
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            CultureInfo culture = LocaleResolver.GetCookie(HttpContext.Current);
            CultureInfo c       = ISTAT.WebClient.WidgetComplements.Model.App_GlobalResources.Messages.SetLocale((string)culture.TwoLetterISOLanguageName);

            Thread.CurrentThread.CurrentUICulture = culture;
            Thread.CurrentThread.CurrentCulture   = culture;
        }
コード例 #2
0
        /// <summary>
        /// Initialize the session, get a cookie for language
        /// </summary>
        /// <param name="sender">
        /// The parameter is not used.
        /// </param>
        /// <param name="e">
        /// The parameter is not used.
        /// </param>
        protected void Session_Start(object sender, EventArgs e)
        {
            Logger.Info("starting session ...");
            try
            {
                RemoveJsTreeCookie(this.Context);
                CultureInfo culture = LocaleResolver.GetCookie(this.Context);
                Thread.CurrentThread.CurrentUICulture = culture;
                Logger.Info("starting session success");


                var query = new SessionQuery {
                    CurrentCulture = culture
                };

                Utils.App_Data_Path = this.Context.Server.MapPath("~/App_Data/");
                string cacheFolder = this.GetCacheFolder();

                query.SetCacheFolder(cacheFolder);
                SessionQueryManager.SaveSessionQuery(this.Context.Session, query);
                Thread.CurrentThread.CurrentUICulture = culture;
                Logger.Info("starting session success");
            }
            catch (HttpException ex)
            {
                Logger.Error("starting session failled");
                Logger.Error(ex.Message, ex);
            }
            catch (SecurityException ex)
            {
                Logger.Error("starting session failled");
                Logger.Error(ex.Message, ex);
            }
            catch (IOException ex)
            {
                Logger.Error("starting session failled");
                Logger.Error(ex.Message, ex);
            }
        }