CurrentCulture question

  • Thread starter Thread starter LushaM
  • Start date Start date
L

LushaM

Hi, all!

I have a question about CurrentCulture
( System.Globalization.CultureInfo.CurrentCulture ). As I understand,
by default, System.Globalization.CultureInfo.CurrentCulture has the
same settings (currency, date, spearators,..) as these that we can see
and edit from Control Panel -> Regional and Language Options.

It is true, when I use CurrentCulture in Console application in .Net
1.1.
But when I use it in ASP.Net Web Application 1.1 CurrentCulture
settings differs from "Regional and Language Options".

I looked web.config and machine.config - globalization section has
default attributes:
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

In ASP.Net 2.0 everything is correct.

Can anyone help me?

Thanks,
Ilya
 
Encoding has nothing to do with culture.

Try setting :

<globalization culture="xx-XX" uiCulture="xx-XX" />

....in web.config.

Substitute the culture you want for "xx-XX"...

See : http://asp.net.do/test/culture3.aspx
for a sample which sets current culture and iuCulture correctly.

If that answers your question, I'll be happy to post the source code for that page.





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espanol : http://asp.net.do/foros/
======================================
 
Thanx for your reply.

I know how to set some predefined culture with
<globalization culture="xx-XX" uiCulture="xx-XX" />
...in web.config.

I need to get settings that user can see and change from Control Panel
-> Regional and Language Options.
For example user can select "Russian" in Regional options and through
Customize button user can change the currency symbol from rouble
(default for Russian culture) to dollar, for exapmle.

I need to get these customized settings.

In Console application .NET 1.1 or ASP.NET 2.0 Web application
System.Globalization.CultureInfo.CurrentCulture works fine for this.

Thanks,
Ilya
 
re:
!> I need to get settings that user can see and change from Control Panel

You don't need to change Windows' Regional and Language Options
in order for ASP.NET applications to be able to display regional options.

Did you see the functionality you are seeking in the sample link I posted ?

http://asp.net.do/test/culture3.aspx





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
I understand your sample, but I need slightly different functionality:

As I understand, in your sample when I choose Danish-Denmark, you load
"da-DK" culture (i.e. format string with this culture) with all
default values for this ("da-DK") culture ( currencySymbol = "kr", for
example).

I'll try to explain what I want to get:
In Control Panel -> Regional and Language Options user selects Danish
culture. Than he or she clicks Customize and selects dollar ($) as
currencySymbol.
So, he gets a modified "da-DK" culture.

My goal is to get this *modified* "da-DK" culture when I start my
application: currencySign = '$', all other params the same with "da-
DK" culture.

In Console application .NET 1.1 or ASP.NET 2.0 Web application
System.Globalization.CultureInfo.CurrentCulture works fine for this.

Thanks,
Ilya
 
Back
Top