I've currently an issue with switching languages in MVC while using async
This works fine :
public ActionResult Index()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr");
return View("Index");
}
This code won't work (when using async, it will keep my default language nl, while it's set to fr):
public async Task<ActionResult> Index()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr");
return View("Index");
}
Any idea why my @Resource won't work when using async and how i could solve this? (for keeping a better overview, i didn't include my await stuff within the code)
Many thanks already!
Edit: I've found some solution, but i'm not sure if it could provide some issues when multiple users are looking on the same page? https://weblogs.asp.net/morteza/how-to-set-currentculture-for-all-threads-in-a-domain-in-net-4-5
Kind regards, Kurt