我有一个完整的应用程序,它使用一个web应用程序,一个数据库,和一些业务逻辑层。问题是它们中的每一个都被配置为使用系统区域性。我需要将它们中的区域性都固定为不变的或标准的。我尝试在web.config中添加全球化标签,但仍然有问题,它似乎不起作用。
我还在布局页面中添加了"globalize.js“脚本,这样脚本就可以像系统的其余部分一样工作,但它也不能工作。
发布于 2013-05-31 14:17:10
尝试将此代码添加到global.asax
using System.Globalization;
using System.Threading;
protected void Application_BeginRequest(object sender, EventArgs e)
{
string lang = Request.RequestContext.RouteData.Values["culture"].ToString();
//CultureInfo culture = CultureInfo.InvariantCulture;//if need invariant
CultureInfo culture = CultureInfo.GetCultureInfo(lang);
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
}对我很管用
https://stackoverflow.com/questions/16848855
复制相似问题