If I set Thread Culture and UICulture for one ASPX, after pass for that page, all my aspx that use the same thread(not same request) will have the same Culture?
Because I need to set Culture just for one ASMX
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the culture you set is not read from the browser settings (like it lives in a database) You need to set this on every request.
As described here:
http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
Override the page’s ‘InitializeCulture’ method on every page. A common base class for all your pages comes in really handy here.
I would suggest firing up .NET reflector and see what the default implementation does. It will help clarify what is going on by default.
As this is event is handled on the page level, and not in the Global.asax, I would expect this is re-set. also, as the article describes, this event is Called so early in the page life cycle that capturing User Input requires directly accessing ‘Request.Form’.
EDIT: Please try this and See that this must be set in every request. Let me know if you see different results or if I misunderstand your question.
Default.aspx: prints ‘21.09.2010’
Default2.aspx: prints ‘9/21/2010’ (my default cluture is es-US)
The order in which you hit these pages does not matter. The results do not change.
One approach people is used is to store this info in a Session variable and use the Session Variables to set the culture ..so logic for this is centerlized.