locked
Localization on a WebMethod inside aspx page RRS feed

  • Question

  • User1774701477 posted

    Hello,

    I have an aspx page in which I've defined a <WebMethod> to call it from javascript client side.

    I have resource files to take localized strings. it works perfectly inside all the website but it doesn't work inside the <WebMethod> defined on aspx page.

    If I ask for  CultureInfo.CurrentCulture.DisplayName, it shows the right culture set but trying to get a string from Resources.Dictionary.MyString, it shows always the string in the default resx file instead of localized resx file.

    Monday, November 17, 2014 4:01 AM

All replies

  • User753101303 posted

    Hi,

    What if you try CultureUICulture instead? Does it use the correct value?

    Monday, November 17, 2014 4:39 AM
  • User1774701477 posted

    Hi and thanks for reply.

    yes, I've fount that I have to set as first instruction of the <WebMethod>:

    Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture

    It this way it seems to work, but really I don't know why....

    Tuesday, November 18, 2014 4:52 AM