Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process.Start specify culture

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?

like image 778
Tjelle Avatar asked Jul 07 '09 15:07

Tjelle


1 Answers

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.

like image 98
Ronald Zarīts Avatar answered Sep 18 '22 14:09

Ronald Zarīts