views:

113

answers:

1

I'm having trouble with CultureInfo in our ASP.NET web application. Our web application returns a different culture, depending on which application pool it is in.

In application pool A, it is en-US, but in application pool B, it's nl-BE.

I'd like it to be nl-BE, but can't find where to change this (IIS6 by the way). I'm not even sure if this can be changed on an app-pool level.

I'm checking with CultureInfo.CurrentCulture.Name.

Is it possible to change this for an application pool? Or what else could influence this? In the regional settings of the server, we have selected 'Dutch (Belgium)', which translates to nl-BE, I believe. So where could this application pool be getting the en-US?

+2  A: 

Yes, it can be different. It's a per-thread property. You can set CurrentCulture for each thread separately.

Are you sure you are not altering the setting somewhere in code? Is <globalization> setting identical for both tests?

If you want to force a specific culture, try something like:

<globalization culture="en-US" uiCulture="en-US" />
Mehrdad Afshari
But if I don't set it in code anywhere, how can I change it back? Or will I have to recycle the application pool?
Peter
@Peter: add a globalization tag to force a specific culture. By the way, is the app pool shared with another app?
Mehrdad Afshari
It isn't share with another app, but I can't say we have sole control over the server. But recycling the app pool has solved the problem. How it came to be en-US is a mystery, but thanks for pointing me to the answer.I tried the globalization tag in our web.config by the way, but it didn't help.
Peter
@Peter: Threads are shared between application domains in a single process (= app pool). Since the ASP.NET request is processed by a thread taken out from a thread pool, that thread may have its culture set to something else previously. I haven't encountered this situation myself but that's my best guess.
Mehrdad Afshari