Wednesday, 9 September 2015

Umbraco current culture in Ajax calls

When making an ajax call in Umbraco current culture may be lost, and access to things like dictionary items on a multilingual site becomes a problem. I fixed this like so in the controller method handling the ajax:

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(GetCurrentCulture());

Where GetCurrentculture simply gets the lcid culture value from session, which is set in on void Session_Start(object sender, EventArgs e) in Global.asax using:


No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!