views:

96

answers:

2

Is there a way to obtain the culture of the server my web application is deployed on through code? We are running an asp.net c# web application on an IIS 7 box with Crystal Reports installed.

+3  A: 

How about:

CultureInfo.CurrentCulture
Eric Smith
Well I tried this and it just returned the culture of my UI. I needed the culture of the OS when it was installed. In order to do that you need to do this: CultureInfo.InstalledUICulture. But this only returns the culture of the OS when it was installed. If you attempt to change the culture and then use it, it will return the originally installed culture anyway. Happy Coding and thanks!
The Sheek Geek
A: 

Why does a web application need to check the server's culture while it should be designed to run on any server?

I think it is weird that a web application can only be deployed to English version of Windows.

Lex Li
You are right. It is weird. The actual issue is, when you install crystal reports, the culture for the application is set based on the server it was deployed on. This means that all dates need to be fed to crystal in a localized format. However, when a user accesses the web application, they can choose from different languages other than the server culture that the application runs on. This changes the appearance of dates and other functionality. However, when that user runs a report, we need to again format the dates to reflect the SERVER culture, hence why we need to know.
The Sheek Geek
May I assume that this is a Crystal Report issue? Did you have a chance to discuss with their support team on that issue? They may already have the answers for your questions.
Lex Li