views:

179

answers:

1

In one webapplication i have a IHttpHandler that when invoked starts an regular application that connects to a firebird database and amongst other things parses some dates from the database.

When run from the desktop the application does what is should without any problem. But when it is started from the httpHandler is ends up with the wrong culture and fails to parse the dates. Ive set the culture i both web.config and CurrentThread.CurrentCulture but it still ends up with the wrong one. All of this is run from an English Windows Server 2003 with the culture set to sv-SE.

So is there a way to start an application with System.Diganotics.Process.Start with a specific culture? If there aren't which culture does the newly started process use?

+1  A: 

I don't think there is a way to specify the culture. The CultureInfo class is specific to .NET, and as far as I know there is no app-specific notion of a culture in windows. There is no way to specify a culture using the Process and ProcessStartInfo classes.

However, I believe the culture is associated with the current user, so what may be happening, is that your Web app is running within a different user's context, so when started from the web app, the other app gets its' users' culture settings. Therefore, you could change the culture (regional settings) for the user that is used to run the web app.

On the other hand, if its' a .NET app you're running, you could just hardcode the culture into it.

ghostskunks
Yes, i have got the feeling that it might have with some user setting to do. Unfortunately its not a .NET application and I cant modify it easily.So the remaining question is. How do i change the regional setting for a system account?
Tjelle
After a tiny bit of research, looks like Locales are the Windows' native equivalent to .NET's CultureInfo-s.A general description here: http://msdn.microsoft.com/en-us/goglobal/bb688174.aspxI found no way to programmatically change the user locale. There might be, so maybe I didn't search hard enough. There may be some way to do this via a command line command (a candidate ServerFault question?). If you're willing to experiment, you could try is temporarily making the user account an interactive one (add it to the Users group), log in, and change the setting via the UI.
ghostskunks