Will ASP.NET cache culture setting?

H

Hardy Wang

Hi,
We migrated some of web applications to a new server. When the server
was installed, the regional setting was EN-CA, later on we found culture
display was not same as from original server (which was EN-US), we reset
server's culture to EN-US.
Now we have 2 web applications still behaviouring as EN-CA setting. It
recoginizes string "03/01/2003" as Januray 3rd 2003, not March 1st 2003.
I checked code, nothing is wrong. I check regional setting of server
(Windows 2000 Advanced Server), it is "English United States", short format
is "M/d?yyyy". I created a small piece of windows application program to
test on this server, it works fine. Only two web applications do not look
good.

So I am wandering when ASP.NET is installed on machine, will it remember
culture selection at that time? I really think not possible, but the factor
makes to suspect.
 
M

Martin Dechev

Hi,

My advice is to set the culture explicitly and to stop worrying about what
Windows and .NET Framework believe it should be. In the
Application_BeginRequest handler set the following:

System.Threading.Thread.CurrentThread.CurrentCulture =
new System.Globalization.CultureInfo("en-US");

(with or without the semi-colon at the end depending on the language you are
using)

Hope this helps
Martin Dechev
ASP.NET MVP
 
H

Hardy Wang

Yes, I would agree with you.

I think set culture and uiCulture of globalization section in web.config
should also work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top