ASP.NET - Display in Local Currency

We have an ASP.NET web portal (VB language) that we intend to use in the United States and the United Kingdom.

Around all the currency fields, we are using <asp:BoundField DataField="DocAmount" HeaderText="Amount" DataFormatString="{0:c2}"/> to control formatting of the value. On the developer's machine, if we flip the Regional Settings from United States to United Kingdom, the display of the currency fields changes as expected.

We recently deployed this project to a production machine in the UK and it shows United States currency format, not UK currency format. We have verified on that server that the Regional Settings are set to United Kingdom.

We noted that the currency format doesn't change on the developer's machine unless we do a rebuild AFTER we changed his regional settings.

Is there some setting on the UK production server that we might be missing?

Who is Participating?
I've seen this problem on some of the servers I've deployed to, I don't believe it's related to build time parameters as my machine is configured to UK regional settings as are all the servers we work with.

While doing some research around the problem I read somewhere that if the server is not initially configured to UK settings, but changed after installation then the NetworkService account that runs under is not changed, which can lead to the problems you have encountered.

Fixing it is relatively simple, if you are deploying to a separate server and are happy for all users to have UK settings then add a globalization element to your web.config (under system.web):

<globalization culture="en-GB" uiCulture="en-GB" />

Alternatively you can detect the users culture from their browser settings and configure based on this, as described here:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.