开发者

Response.write and locale settings

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

The prob开发者_运维问答lem 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.


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); 


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

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

for example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜