Response.write 和区域设置

发布于 2024-09-29 12:01:00 字数 316 浏览 0 评论 0原文

我正在使用 VB .NET 4.0、ISS 7.0。 我想知道如何为所有应用程序设置默认区域设置?

当我有 Response.Write(str) 时,问题就出现了,数字显示为“,”(德语表示法)而不是“.”(美国表示法)。

.NET从哪里知道他需要使用德语语言环境?

在我添加的每个 js 脚本中,

 Session.LCID = 3081;//  to fix the ,->.

但这是解决问题的强力解决方案。有没有更优雅的方式来配置服务器/.NET?

谢谢
阿曼.

I am using VB .NET 4.0, ISS 7.0.
I wondered how can I set the default locale for all applications?

The problem is rising when I have a Response.Write(str) the numbers appear with ","(german notation) rather than "."(us notation).

From where .NET knows that he need to use the german locale?

In every my js script I have added

 Session.LCID = 3081;//  to fix the ,->.

but this is the brute force solution to fix the problem. Are there more elegant way to configure the server/.NET?

thanks
Arman.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初懵 2024-10-06 12:01:00

您可以在 app.config 中设置区域设置,

只需添加

<configuration>
<system.web>
<globalization culture="CULTUREHERE, for example de-DE" />
</system.web>
</configuration>

或者,您可以通过设置当前区域性来更改应用程序线程在启动时使用的区域性:

Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE", false); 

You can set the locale in your app.config

Just add

<configuration>
<system.web>
<globalization culture="CULTUREHERE, for example de-DE" />
</system.web>
</configuration>

Alternatively, you can change the culture your application thread uses at startup by setting the Current Culture:

Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE", false); 
一人独醉 2024-10-06 12:01:00

您需要使用数字格式CultureInfo a> 选项:

123.456(“C”,fr-FR)-> 123.46 欧元

例如

You need to use the CultureInfo in the Numeric Format options:

123.456 ("C", fr-FR) -> 123,46 €

for example

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文