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 changed to 4.6.1, the culture isn't preserved anymore and as a result it just doesn't work.
I can reproduce it in a very simple solution which only has this middleware simulating the culture change
public class CultureMiddleware : OwinMiddleware
{
public CultureMiddleware(OwinMiddleware next)
: base(next)
{
}
public override async Task Invoke(IOwinContext context)
{
var culture = new CultureInfo("es-ES");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
await Next.Invoke(context);
}
}
I attach the middleware to the pipeline it gets execute but when I'm calling an action the controller doesn't have the culture (like it had in .net 4.5.1)
I already posted here but the support is really slow. One Answer every two weeks and then it seems like they haven't tried what they write :-(
https://connect.microsoft.com/VisualStudio/feedback/details/2455357
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With