Setting requested Culture when consuming web services

Go To


I am looking for some solution how I could easily set the requested Culture at client and get it on server. So I would get for example return error message in requested language.
Is there way to set it on WebRequest or WebMethod?

Any suggestion most welcome. Thanks X.

Edit: Finally I used Soap header to carry cultureinfo setting from client to server. Which is fine I suppose. I was just more hoping that it could be set at lower level and not by using customization of SoapHeader. Anyway it works. :-)

2009-06-16 09:59
by Jaroslav Urban


You could pass the desired culture as a parameter and set the culture at server side with:

Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang); 
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); 
2009-06-16 10:12
by Jordi
th, however that is not what I am looking for. I am familiar with how to set the culture. I am more consider about way how to transport this information between client and server. So what did you mean by pass it as a parameter - Jaroslav Urban 2009-06-16 10:21
You can pass it as a parameter to all of the relevant operations, or you can pass it in a SOAP Header that is used by all of the operations that require the culture - John Saunders 2009-06-17 02:55