Localized Exception Message

L

Luthgers, John

Hi,

my application uses a global exception handler to catch any unhandled
exceptions and then shows a dialog to inform the user. The dialog shows the
exception content and gives the ability to send an error report to my
website. Now i noticed, that the exception text of system exceptions can by
localized by installing the dotnet language packs. The result is, that some
users send a japanese exception to the website.

My goal is:
1) show the user the localized exception message within the dialog
2) send the exception in english to the website, so i can read it later :)

Goal 1 is already accomplished. And I know that i can change the culture via
"Thread.CurrentThread.CurrentUICulture" to english, but that works only if
the culture is set before the exception is thrown and doing so avoid the
abillity to show a localized version of the message to the user.

Is there any way to "reinit" the text of an exception based on the current
culture?

-J-
 
A

Alvin Bruney [ASP.NET MVP]

Well, there is but it doesn't jive with your approach. Your application runs
on the server, you should not be localizing exceptions on the server since
the support personnel is expected to see the message in their local. What
you should do is translate the message that will be sent to the client in
the requesting locale. That way, german folk see german messages but support
personal in England see English exception messages. I'd argue here that
clients should never see an exception if it wasn't sanitized in some way.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/Default.aspx
 

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

Top