加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET全球化:Culture =“auto”页面指令,中性文化崩溃?

发布时间:2020-12-16 04:08:07 所属栏目:asp.Net 来源:网络整理
导读:我遇到了一个使用内置全球化设施的ASP.NET应用程序崩溃的情况. 在具有Culture =“auto”指令的ASP.NET页面上,具有中性文化作为其浏览器语言的用户(例如“zh-Hans”)将产生以下异常: Culture ‘zh-Hans’ is a neutral culture. It cannot be used in format
我遇到了一个使用内置全球化设施的ASP.NET应用程序崩溃的情况.

在具有Culture =“auto”指令的ASP.NET页面上,具有中性文化作为其浏览器语言的用户(例如“zh-Hans”)将产生以下异常:

Culture ‘zh-Hans’ is a neutral culture. It cannot be used in
formatting and parsing and therefore
cannot be set as the thread’s current
culture.

at System.Globalization.CultureInfo.CheckNeutral(CultureInfo
culture)
at System.Threading.Thread.set_CurrentCulture(CultureInfo
value)
at System.Web.UI.Page.set_Culture(String
value)
at ASP.somePage_aspx.__BuildControlTree(somePage_aspx __ctrl)
at ASP.somePage_aspx.FrameworkInitialize()

有任何想法吗?输入Culture / UICulture参数的垃圾通常似乎被忽略,但是这种情况导致了未处理的异常.

解决方法

首先,您可以考虑在<%@ Page%>中设置UICulture =“auto”以及Culture =“auto”.宣言.

现在,我没有看到我的.NET 4.0(beta)安装上的这个repro,所以这可能是.NET 3.5中的产品错误.

这是学习中性文化以及UICulture和Culture之间差异的重要资源:http://blogs.msdn.com/ddietric/archive/2008/02/05/yacvcp-yet-another-currentculture-vs-currentuiculture-post.aspx

希望这很有帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读