开发者

New thread in ASP.NET runs in different culture

开发者 https://www.devze.com 2023-01-30 02:32 出处:网络
I have System.Timers.Timer that performs some operations based on schedule. When timer rise开发者_开发知识库s event, the threads culture is \'ru-RU\' differ from culture in my web config.

I have System.Timers.Timer that performs some operations based on schedule. When timer rise开发者_开发知识库s event, the threads culture is 'ru-RU' differ from culture in my web config.

<globalization culture="en-US" uiCulture="en-US" requestEncoding="utf-8" responseEncoding="utf-8" />

I guess the culture in timer handler based on my regional settings which is ru-RU. Currently i set it manually to 'en-US' in timer handler, but i think this is not the best way to solve the problem.

In any case is there another solution to have the same culture in another thread as in my web config except setting it manually?


That is very strange. Every thread that creates another thread will pass on all the context including security and locale.

Add a debug code to check the Culture and UICulture of the Thread.CurrentThread at the time of creation of thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消