1

Closed

Localization does not work in IIS7

description

I had a lot of trouble to get the localization working running IIS7. When the GlobalizationHttpModule is setting the Culture to the current thread it seems to get overwritten later on. My solution was to overwrite Initialize in the base class WebController. I removed consequentally the entry of the GlobalizationHttpModule from the web.config.
 
    protected override void Initialize(System.Web.Routing.RequestContext requestContext)
    {
        base.Initialize(requestContext);
 
        if (System.Web.HttpContext.Current.Session.IsNull())
        {
            return;
        }
        var ci = System.Web.HttpContext.Current.Session[GlobalizationManager.Constants.CultureInfo] as CultureInfo;
        if (ci.Is())
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = ci;
            ProjectBase.Core.Extensions.Log(typeof(GlobalizationHttpModule)).Info(string.Format("{0}", System.Threading.Thread.CurrentThread.CurrentUICulture.DisplayName));
        }
        var ciu = System.Web.HttpContext.Current.Session[GlobalizationManager.Constants.CultureUIInfo] as CultureInfo;
        if (ciu.Is())
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = ciu;
            ProjectBase.Core.Extensions.Log(typeof(GlobalizationHttpModule)).Info(string.Format("{0}", System.Threading.Thread.CurrentThread.CurrentUICulture.DisplayName));
        }
    }
Closed Sep 5, 2009 at 5:33 PM by Radim

comments

wrote Sep 5, 2009 at 5:33 PM

Resolved with changeset 28670.

wrote Feb 14, 2013 at 12:26 AM

wrote May 16, 2013 at 6:07 AM