I have an owin culture middle ware running very nice.
It just changes the culture according to the url. This works in 4.5.* perfectly. Now when the runtiome is chang
I also tried to fix it with OwinMiddleware but failed.
My solution was to create an ActionFilterAttribute and register this at startup:
public partial class Startup : UmbracoDefaultOwinStartup
{
public override void Configuration(IAppBuilder app)
{
GlobalFilters.Filters.Add(new CultureCookieFilter());
base.Configuration(app);
}
}
public class CultureCookieFilter : ActionFilterAttribute
{
private const string CULTURE_KEY = "X-Culture";
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.HttpContext.Request.Cookies[CULTURE_KEY] != null)
{
var langCookie = filterContext.HttpContext.Request.Cookies[CULTURE_KEY];
if (langCookie != null)
{
var lang = langCookie.Value;
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
}
}
base.OnActionExecuting(filterContext);
}
}
I got a response from microsoft which works for me.
you can try set the following element in your web.config file. This element has to be child to the
<appSettings>
element.
<add key="appContext.SetSwitch:Switch.System.Globalization.NoAsyncCurrentCulture" value="true" />