Process.Start specify culture

In one web application, I have IHttpHandler, which at startup launches a regular application that connects to the Firebird database and, among other things, parses some dates from the database.

When launched from the desktop, the application does what it should be without problems. But when it is launched with httpHandler, it ends up in the wrong culture and does not parse dates. Ive set the culture in both web.config and CurrentThread.CurrentCulture, but it still ends up wrong. All this starts from Windows Server 2003 English with the culture installed in sv-SE.

So, is there a way to run the application with System.Diganotics.Process.Start with a specific culture? If not the culture that the recently launched process uses?

+6
c # globalization
source share
1 answer

I donโ€™t think there is a way to indicate culture. The CultureInfo class is specific for .NET, and as far as I know, windows do not have an application-specific concept of culture. Cannot specify culture using the Process and ProcessStartInfo classes.

However, I believe that the culture is associated with the current user, so it may happen that your web application works in a different user context, so when you start from the web application, another application gets its โ€œusersโ€ culture settings. Therefore, you can change the culture (regional settings) for the user who is used to launch the web application.

On the other hand, if this is the .NET application that you are using, you can just hardcode the culture to it.

+2
source share

All Articles