ASP.NET user's locale question

J

Jon Wang

where do you store the information about the user's locale?

I got the answer online saying that it's System.UI.Page.Culture. But I
think it should be Thread.CurrentThread.CurrentCulture and
Thread.CurrentThread.CurrentUICulture. Could you please let me know which
answer is right?
 
K

Karl Seguin

Thread.CurrentThread.CurrentCulture and
Thread.CurrentThread.CurrentUICulture

AS far as I know Page.Culture doesn't even exist, and even if it did you
typically want the culture set thread-wide, so that business logic will also
run in the specified culture.

Karl
 
B

bruce barker

because of asp.nets thread agility, you have to be very carefull with
setting the culture of a thread in asp.net. normally a webrequest is not
serviced by the same thread for all of the page processing calls (events).
i.e., if you set the thread culture on the pageload event, you are not
guaranteed the same culture setting will be in effect during the on a click
event for the same page request.

before calling any routines that need culture set - you should set the
culture, call the routine, then restore the culture to your default. this
will prevent the culture getting changed when you do not expect it.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top