ASP.NET全球化:文化= QUOT;汽车"页面指令中性文化的碰撞? [英] ASP.NET Globalization: Culture="auto" page directive with neutral culture crash?
问题描述
我运行到哪里使用ASP.NET应用程序内置的全球化设施崩溃的情况。
在与文化=自动指令,用中性文化为他们的浏览器的语言(如ZH-汉斯)的用户ASP.NET页面会产生以下异常:
文化ZH-汉斯'是中性的文化。它不能在被使用
格式化和分析,因此
不能被设置为线程的当前
文化。
在System.Globalization.CultureInfo.CheckNeutral(的CultureInfo
文化)
在System.Threading.Thread.set_CurrentCulture(的CultureInfo
值)
在System.Web.UI.Page.set_Culture(字符串
值)
在ASP.somePage_aspx .__ BuildControlTree(somePage_aspx __CTRL)
在ASP.somePage_aspx.FrameworkInitialize()
块引用>任何想法?垃圾送入文化/的UICulture参数一般似乎被忽略,但这种情况下,导致了未处理的异常。
解决方案首先,你可以考虑在你的&LT设置的UICulture =自动,以及文化=自动;%@页%>声明。 p>
现在,我没有看到我的.NET 4.0(测试版)安装此摄制,所以这可能是在.NET 3.5的产品缺陷。
下面是了解中性文化和的UICulture和文化之间的差异有很大的资源:<一href=\"http://blogs.msdn.com/ddietric/archive/2008/02/05/yacvcp-yet-another-currentculture-vs-currentuiculture-post.aspx\" rel=\"nofollow\">http://blogs.msdn.com/ddietric/archive/2008/02/05/yacvcp-yet-another-currentculture-vs-currentuiculture-post.aspx
希望这是有帮助的。
I'm running into a case where an ASP.NET application using the built-in globalization facilities is crashing.
On an ASP.NET page with the Culture="auto" directive, a user with a neutral culture as their browser language (such as "zh-Hans") will produce the following exception:
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()
Any ideas? Garbage fed into the Culture/UICulture parameters generally seem to be ignored, but this case is causing an unhandled exception.
解决方案First off, you might consider setting UICulture="auto" as well as Culture="auto" in your <%@ Page %> declaration.
Now, I am not seeing this repro on my .NET 4.0 (beta) install, so this might be a product bug in .NET 3.5.
Here's a great resource for learning about neutral cultures and the difference between UICulture and Culture: http://blogs.msdn.com/ddietric/archive/2008/02/05/yacvcp-yet-another-currentculture-vs-currentuiculture-post.aspx
Hope that's helpful.
这篇关于ASP.NET全球化:文化= QUOT;汽车&QUOT;页面指令中性文化的碰撞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!