tags:

views:

29

answers:

1

For example, my asp.net application has a user which has an account number, name, address and a culture.

I know exceptions should rarely be shown to the user.

But lets say I do want to use this framework exception message localized, is it possible?

something like

catch(Exception ex)
{
ex.ShowLocalizedMessage(myCurrentUser.CurrentCulture)
}
+1  A: 

Framework exceptions will always be localized using the current thread's CurrentUICulture. If you change the property on the thread, the exception messages will follow. (This is usually seen as more of a problem than a benefit, but ymmv...)

Nicole Calinoiu
ok, now we know which culture it uses, now a culture is a culture, my user's is just as valid, anyway I can use his? Is a .net session always a thread, what I want to make sure is that im not passing something already built in?
GenEric35
The easiest way to use the client culture is to set the value of the uiCulture attribute of the globalization element to "auto" in your web.config file. (http://msdn.microsoft.com/en-us/library/hy4kkhe0.aspx)
Nicole Calinoiu