我按例子
1)首先添加了两个资源文件
message.zh-cn.resx
message.en.resx
2)在Global文件里,代码如下 protected void Application_BeginRequest(Object sender, EventArgs e)
{
// 用浏览器指定的用户语言来
// 为每个区域性值进行初始化
try
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
}
catch(Exception)
{
// 为不支持的语言提供备用值。仅作为某些特定的情形下的安全措施
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
} Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; }
3)在WEB.CONFI文件里
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
<appSettings>
<add key="DefaultLang" value="zh-cn" />
<!-- zh-cn:簡體中文 zh-tw:繁體中文 en:英文 -->
</appSettings>
就出错了.
大家帮看看了了,急~~~
1)首先添加了两个资源文件
message.zh-cn.resx
message.en.resx
2)在Global文件里,代码如下 protected void Application_BeginRequest(Object sender, EventArgs e)
{
// 用浏览器指定的用户语言来
// 为每个区域性值进行初始化
try
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
}
catch(Exception)
{
// 为不支持的语言提供备用值。仅作为某些特定的情形下的安全措施
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
} Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; }
3)在WEB.CONFI文件里
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
<appSettings>
<add key="DefaultLang" value="zh-cn" />
<!-- zh-cn:簡體中文 zh-tw:繁體中文 en:英文 -->
</appSettings>
就出错了.
大家帮看看了了,急~~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货