By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 744 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Web site switching to Euro

P: n/a
Max
My client has decided to use the Euro for the entire web site. Is there an
easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd rather
set this say at start up in the global.asax since other web sites running on
the server may not share this setting.

-Max
Nov 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On January
1, 2002, these nations started using euro bank notes and coins. Therefore,
the .NET Framework and Microsoft Windows XP set the default currency symbol
to the euro, for these twelve nations using the euro as the official
currency. Older versions of Windows will still set the default currency
symbol to the local currency for these nations.

You should be aware of operating system differences with respect to default
currency symbols. In Windows, users are able to override some of the values
associated with the system's default culture through Regional and Language
Options (or Regional Options or Regional Settings) in Control Panel. For
example, a user can choose to display currency using a symbol other than the
default for the culture. Windows Forms and console applications use the
default currency symbol specified on the user's system. A user in a
euro-adopting country or region, on an older version of Windows, who has not
updated the currency setting to the euro through the Regional Options or
Regional Settings in Control Panel, will have an incorrect default currency
setting. ASP.NET applications and XML Web service applications created in
ASP.NET run as system services, not for specific users. Therefore, the
default results they return might differ from those returned by Windows
Forms and console applications.

It is recommended that you write code that uses the .NET Framework default
currency settings for a culture to shield your application from operating
systems differences and ensure consistent currency formatting. Create a
CultureInfo using one of its constructor overloads that accepts a
useUserOverride parameter, and set this parameter to false. This will cause
the default currency setting on the user's system to be overridden by the
..NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there an
easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd rather
set this say at start up in the global.asax since other web sites running
on the server may not share this setting.

-Max


Nov 19 '05 #2

P: n/a
Max
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the date is
displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some of
the values associated with the system's default culture through Regional
and Language Options (or Regional Options or Regional Settings) in Control
Panel. For example, a user can choose to display currency using a symbol
other than the default for the culture. Windows Forms and console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older version
of Windows, who has not updated the currency setting to the euro through
the Regional Options or Regional Settings in Control Panel, will have an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework default
currency settings for a culture to shield your application from operating
systems differences and ensure consistent currency formatting. Create a
CultureInfo using one of its constructor overloads that accepts a
useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there
an easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd
rather set this say at start up in the global.asax since other web sites
running on the server may not share this setting.

-Max

Nov 19 '05 #3

P: n/a
Hi, Max.

Here's a complete working example.

It's not a 1 or 2 liner, and it isn't even in global.asax,
but it should give you an idea about what to do.

Eurocurrency.aspx :
-----------------------
<%@ Page language="C#" debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<html>
<head>
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DeCulture = new CultureInfo("de-DE", false); // set the culture to an EU nation
Thread.CurrentThread.CurrentCulture = DeCulture;

NumberFormatInfo LocalFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne(); //Clone the format so it can be duplicated
LocalFormat.CurrencySymbol = "DM"; // Replace currency symbol with DM sign.
Decimal myCurrency = new Decimal( 123456 ); // set a number to be displayed in currency format later

myCurrency.ToString( "C", LocalFormat ); //Convert 123456 to Euro currency format

OutString = "Euro : " + myCurrency.ToString( "C", NumberFormatInfo.CurrentInfo ); // Insert into outstring the Euro-formatted string

OutString += "<br>" + "German Mark : " + myCurrency.ToString( "C", LocalFormat ); // convert to marks, for good mesure

CultureInfo EnUSCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = EnUSCulture;
OutString += "<br>" + "US Dollar : " + myCurrency.ToString( "C", NumberFormatInfo.CurrentInfo ); // convert to dollars, for good mesure

Response.Write( OutString );
}
</SCRIPT>
</head>
<body>
</body>
</html>
---------------------

This should work.
It works for me locally, and my local culture is "es-DO".

Have fun!


Juan T. Llibre
ASP.NET MVP
===========

"Max" <no****@notvalid.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the date
is displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some of
the values associated with the system's default culture through Regional
and Language Options (or Regional Options or Regional Settings) in
Control Panel. For example, a user can choose to display currency using a
symbol other than the default for the culture. Windows Forms and console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older version
of Windows, who has not updated the currency setting to the euro through
the Regional Options or Regional Settings in Control Panel, will have an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework
default currency settings for a culture to shield your application from
operating systems differences and ensure consistent currency formatting.
Create a CultureInfo using one of its constructor overloads that accepts
a useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there
an easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd
rather set this say at start up in the global.asax since other web sites
running on the server may not share this setting.

-Max

Nov 19 '05 #4

P: n/a
Max
I still don't understand... none of this works. My application still goes by
the regional and language options of the server. I want the application to
override the server settings.

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi, Max.

Here's a complete working example.

It's not a 1 or 2 liner, and it isn't even in global.asax,
but it should give you an idea about what to do.

Eurocurrency.aspx :
-----------------------
<%@ Page language="C#" debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<html>
<head>
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DeCulture = new CultureInfo("de-DE", false); // set the culture
to an EU nation
Thread.CurrentThread.CurrentCulture = DeCulture;

NumberFormatInfo LocalFormat =
(NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne(); //Clone the format
so it can be duplicated
LocalFormat.CurrencySymbol = "DM"; // Replace currency symbol with DM sign.
Decimal myCurrency = new Decimal( 123456 ); // set a number to be displayed
in currency format later

myCurrency.ToString( "C", LocalFormat ); //Convert 123456 to Euro currency
format

OutString = "Euro : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // Insert into outstring the Euro-formatted
string

OutString += "<br>" + "German Mark : " + myCurrency.ToString( "C",
LocalFormat ); // convert to marks, for good mesure

CultureInfo EnUSCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = EnUSCulture;
OutString += "<br>" + "US Dollar : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // convert to dollars, for good mesure

Response.Write( OutString );
}
</SCRIPT>
</head>
<body>
</body>
</html>
---------------------

This should work.
It works for me locally, and my local culture is "es-DO".

Have fun!


Juan T. Llibre
ASP.NET MVP
===========

"Max" <no****@notvalid.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the date
is displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some of
the values associated with the system's default culture through Regional
and Language Options (or Regional Options or Regional Settings) in
Control Panel. For example, a user can choose to display currency using a
symbol other than the default for the culture. Windows Forms and console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older version
of Windows, who has not updated the currency setting to the euro through
the Regional Options or Regional Settings in Control Panel, will have an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework
default currency settings for a culture to shield your application from
operating systems differences and ensure consistent currency formatting.
Create a CultureInfo using one of its constructor overloads that accepts
a useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there
an easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd
rather set this say at start up in the global.asax since other web sites
running on the server may not share this setting.

-Max

Nov 19 '05 #5

P: n/a
Max
Here I found it in the web.config. My site displays EURO now!

<globalization culture="de-DE" uiCulture="de-DE" requestEncoding="utf-8"
responseEncoding="utf-8" />

"Max" <no****@notvalid.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
I still don't understand... none of this works. My application still goes
by the regional and language options of the server. I want the application
to override the server settings.

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi, Max.

Here's a complete working example.

It's not a 1 or 2 liner, and it isn't even in global.asax,
but it should give you an idea about what to do.

Eurocurrency.aspx :
-----------------------
<%@ Page language="C#" debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<html>
<head>
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DeCulture = new CultureInfo("de-DE", false); // set the
culture to an EU nation
Thread.CurrentThread.CurrentCulture = DeCulture;

NumberFormatInfo LocalFormat =
(NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne(); //Clone the format
so it can be duplicated
LocalFormat.CurrencySymbol = "DM"; // Replace currency symbol with DM
sign.
Decimal myCurrency = new Decimal( 123456 ); // set a number to be
displayed in currency format later

myCurrency.ToString( "C", LocalFormat ); //Convert 123456 to Euro currency
format

OutString = "Euro : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // Insert into outstring the
Euro-formatted string

OutString += "<br>" + "German Mark : " + myCurrency.ToString( "C",
LocalFormat ); // convert to marks, for good mesure

CultureInfo EnUSCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = EnUSCulture;
OutString += "<br>" + "US Dollar : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // convert to dollars, for good mesure

Response.Write( OutString );
}
</SCRIPT>
</head>
<body>
</body>
</html>
---------------------

This should work.
It works for me locally, and my local culture is "es-DO".

Have fun!


Juan T. Llibre
ASP.NET MVP
===========

"Max" <no****@notvalid.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the date
is displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some of
the values associated with the system's default culture through Regional
and Language Options (or Regional Options or Regional Settings) in
Control Panel. For example, a user can choose to display currency using
a
symbol other than the default for the culture. Windows Forms and console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older version
of Windows, who has not updated the currency setting to the euro through
the Regional Options or Regional Settings in Control Panel, will have an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework
default currency settings for a culture to shield your application from
operating systems differences and ensure consistent currency formatting.
Create a CultureInfo using one of its constructor overloads that accepts
a useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there
an easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd
rather set this say at start up in the global.asax since other web
sites
running on the server may not share this setting.

-Max


Nov 19 '05 #6

P: n/a
I think the problem is that the culture settings
for Norway don't default to the Euro symbol,
while the culture settings for other European
nations do default to the Euro.

See my example, online, at http://asp.net.do/test/eurocurrency2.aspx

The Euro example at the top is for German culture ("de-DE"),
while the example at the bottom is for the Norway culture ("nn-NO")

Noptice that the DE culture displays the Euro,
which the Norway culture displays the Krone.

I added the localization to Dominican Pesos so you can see what
happens when you specify a culture which uses other currency symbols.

If you import the two classes :

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>

and run these 2 scripts in the Page_Load event in different pages,
you'll see that when the nn-NO script runs, the display is in KR,
but when the de-DE script runs, the display is in Euros.
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo NOCulture = new CultureInfo("nn-NO", false);
Thread.CurrentThread.CurrentCulture = NOCulture;
Decimal myCurrency = new Decimal( 123456 );
OutString = "Norway : " + myCurrency.ToString( "C", NumberFormatInfo.CurrentInfo );
Response.Write( OutString );
}
</SCRIPT>

<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DECulture = new CultureInfo("de-DE", false);
Thread.CurrentThread.CurrentCulture = DECulture;
Decimal myCurrency = new Decimal( 123456 );
OutString = "Germany : " + myCurrency.ToString( "C", NumberFormatInfo.CurrentInfo );
Response.Write( OutString );
}
</SCRIPT>

See the results of these 2 scripts at :

http://asp.net.do/test/eurocurrencyDE.aspx
and
http://asp.net.do/test/eurocurrencyNO.aspx

You could work around this by cloning the cultureinfo,
and substituting the Euro symbol for the kr symbol:
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo nnNOCulture = new CultureInfo("nn-NO", false);
Thread.CurrentThread.CurrentCulture = nnNOCulture;
NumberFormatInfo LocalFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne();
LocalFormat.CurrencySymbol = "&euro;"; // Replace Krone currency symbol with Euro symbol.
Decimal myCurrency = new Decimal( 123456 );
OutString = "Norway Culture with symbol substituted : " + myCurrency.ToString("C", LocalFormat);
Response.Write( OutString );
}
</SCRIPT>

See *that* script demonstrated at
http://asp.net.do/test/eurocurrencyClone.aspx

There's not much more than I can do for you.
I hope you gets this to work.


Juan T. Llibre
ASP.NET MVP
===========
"Max" <no****@notvalid.com> wrote in message news:u8**************@tk2msftngp13.phx.gbl...
I still don't understand... none of this works. My application still goes by
the regional and language options of the server. I want the application to
override the server settings.



"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi, Max.

Here's a complete working example.

It's not a 1 or 2 liner, and it isn't even in global.asax,
but it should give you an idea about what to do.

Eurocurrency.aspx :
-----------------------
<%@ Page language="C#" debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<html>
<head>
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DeCulture = new CultureInfo("de-DE", false); // set the culture
to an EU nation
Thread.CurrentThread.CurrentCulture = DeCulture;

NumberFormatInfo LocalFormat =
(NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne(); //Clone the format
so it can be duplicated
LocalFormat.CurrencySymbol = "DM"; // Replace currency symbol with DM sign.
Decimal myCurrency = new Decimal( 123456 ); // set a number to be displayed
in currency format later

myCurrency.ToString( "C", LocalFormat ); //Convert 123456 to Euro currency
format

OutString = "Euro : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // Insert into outstring the Euro-formatted
string

OutString += "<br>" + "German Mark : " + myCurrency.ToString( "C",
LocalFormat ); // convert to marks, for good mesure

CultureInfo EnUSCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = EnUSCulture;
OutString += "<br>" + "US Dollar : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // convert to dollars, for good mesure

Response.Write( OutString );
}
</SCRIPT>
</head>
<body>
</body>
</html>
---------------------

This should work.
It works for me locally, and my local culture is "es-DO".

Have fun!




Juan T. Llibre
ASP.NET MVP
===========

"Max" <no****@notvalid.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the date
is displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some of
the values associated with the system's default culture through Regional
and Language Options (or Regional Options or Regional Settings) in
Control Panel. For example, a user can choose to display currency using a
symbol other than the default for the culture. Windows Forms and console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older version
of Windows, who has not updated the currency setting to the euro through
the Regional Options or Regional Settings in Control Panel, will have an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework
default currency settings for a culture to shield your application from
operating systems differences and ensure consistent currency formatting.
Create a CultureInfo using one of its constructor overloads that accepts
a useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
My client has decided to use the Euro for the entire web site. Is there
an easy way to get my ASP.NET app to format currency to Euro instead of
US-dollar? Right now it's just reading the server settings, but I'd
rather set this say at start up in the global.asax since other web sites
running on the server may not share this setting.

-Max


Nov 19 '05 #7

P: n/a
Good.

For some odd reason I thought you wanted to
do this in code, on a page by page basis,
( although in your 1st message you did say
"for the whole web site" ), so that's why I
was sending you all the code.

It's strange that you reported that the scripts
didn't work, though, because my global culture
settings in web.config are "es-DO", and the scripts
do work. They should have worked for you, too.

Best of luck!

Juan T. Llibre
ASP.NET MVP
===========
"Max" <no****@notvalid.com> wrote in message
news:uX**************@TK2MSFTNGP15.phx.gbl...
Here I found it in the web.config. My site displays EURO now!

<globalization culture="de-DE" uiCulture="de-DE" requestEncoding="utf-8"
responseEncoding="utf-8" />

"Max" <no****@notvalid.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
I still don't understand... none of this works. My application still goes
by the regional and language options of the server. I want the application
to override the server settings.

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi, Max.

Here's a complete working example.

It's not a 1 or 2 liner, and it isn't even in global.asax,
but it should give you an idea about what to do.

Eurocurrency.aspx :
-----------------------
<%@ Page language="C#" debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<html>
<head>
<SCRIPT runat="server">
void Page_Load(){
String OutString = "";
CultureInfo DeCulture = new CultureInfo("de-DE", false); // set the
culture to an EU nation
Thread.CurrentThread.CurrentCulture = DeCulture;

NumberFormatInfo LocalFormat =
(NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clo ne(); //Clone the
format so it can be duplicated
LocalFormat.CurrencySymbol = "DM"; // Replace currency symbol with DM
sign.
Decimal myCurrency = new Decimal( 123456 ); // set a number to be
displayed in currency format later

myCurrency.ToString( "C", LocalFormat ); //Convert 123456 to Euro
currency format

OutString = "Euro : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // Insert into outstring the
Euro-formatted string

OutString += "<br>" + "German Mark : " + myCurrency.ToString( "C",
LocalFormat ); // convert to marks, for good mesure

CultureInfo EnUSCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = EnUSCulture;
OutString += "<br>" + "US Dollar : " + myCurrency.ToString( "C",
NumberFormatInfo.CurrentInfo ); // convert to dollars, for good mesure

Response.Write( OutString );
}
</SCRIPT>
</head>
<body>
</body>
</html>
---------------------

This should work.
It works for me locally, and my local culture is "es-DO".

Have fun!


Juan T. Llibre
ASP.NET MVP
===========

"Max" <no****@notvalid.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Anyone have 1 or 2 line global.asax example? I just added:

Thread.CurrentThread.CurrentCulture = New CultureInfo("nn-NO")

to the Application_Start() but nothing has changed, not even how the
date
is displayed.

-Max
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi Max,

You'll want to check out useUserOverride and look under this heading:

Formatting Currency for Euro Nations

"The CultureInfo and the RegionInfo classes both include information on
currency. Only one currency is specified per culture. The euro is the
official currency of Belgium, Germany, Spain, France, Ireland, Italy,
Luxembourg, Netherlands, Austria, Portugal, Finland, and Greece. On
January 1, 2002, these nations started using euro bank notes and coins.
Therefore, the .NET Framework and Microsoft Windows XP set the default
currency symbol to the euro, for these twelve nations using the euro as
the official currency. Older versions of Windows will still set the
default currency symbol to the local currency for these nations.

You should be aware of operating system differences with respect to
default currency symbols. In Windows, users are able to override some
of
the values associated with the system's default culture through
Regional
and Language Options (or Regional Options or Regional Settings) in
Control Panel. For example, a user can choose to display currency using
a
symbol other than the default for the culture. Windows Forms and
console
applications use the default currency symbol specified on the user's
system. A user in a euro-adopting country or region, on an older
version
of Windows, who has not updated the currency setting to the euro
through
the Regional Options or Regional Settings in Control Panel, will have
an
incorrect default currency setting. ASP.NET applications and XML Web
service applications created in ASP.NET run as system services, not for
specific users. Therefore, the default results they return might differ
from those returned by Windows Forms and console applications.

It is recommended that you write code that uses the .NET Framework
default currency settings for a culture to shield your application from
operating systems differences and ensure consistent currency
formatting.
Create a CultureInfo using one of its constructor overloads that
accepts
a useUserOverride parameter, and set this parameter to false. This will
cause the default currency setting on the user's system to be
overridden
by the .NET Framework's correct default setting."

http://msdn.microsoft.com/library/en...asp?frame=true

http://msdn.microsoft.com/library/de...rridetopic.asp

"Max" <no****@notvalid.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
> My client has decided to use the Euro for the entire web site. Is
> there
> an easy way to get my ASP.NET app to format currency to Euro instead
> of
> US-dollar? Right now it's just reading the server settings, but I'd
> rather set this say at start up in the global.asax since other web
> sites
> running on the server may not share this setting.
>
> -Max



Nov 19 '05 #8

P: n/a
Max
Well the info you provided will be helpful when the client decides he needs
different languages. It appears I need to change a lot of code to really do
this right. Thanks for your help.

-Max
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Good.

For some odd reason I thought you wanted to
do this in code, on a page by page basis,
( although in your 1st message you did say
"for the whole web site" ), so that's why I
was sending you all the code.

Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.