Setting culture for session

后端 未结 2 1085
余生分开走
余生分开走 2021-01-20 03:35

Each user of my application will choose their country, after which it will be stored in a cookie and stored for later requests. Everything is working OK, but I need to set t

相关标签:
2条回答
  • 2021-01-20 03:44

    You must set the culture on each call, Session_Start is only fired when a session is created. So your culture is correct only on first call or when the session is recreated.

    0 讨论(0)
  • 2021-01-20 03:52

    You are assuming that the thread that will service the page request is the same thread that has started the session as in your code - this is not guaranteed.

    You may want to save the culture in a Session variable and use an override InitializeCulture in your pages, as described in: How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization.

    0 讨论(0)
提交回复
热议问题