Read regional and language options of client

wakeup

Freshman
Joined
Nov 9, 2004
Messages
35
Do yout know if I can read regional and language options of client windows in asp.net?
I need know decimal simbol.
Thanks
 
You could always use Request.UserLanguages to see what languages the client supports. It should return an array of strings with position 0 being the default. Something like the following should work...
Visual Basic:
Dim Language As String = Request.UserLanguages(0)

If Not ((Language Is Nothing) OrElse (Language.IndexOf("-") < 0)) Then
    Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(Language)
    Dim CurrencySymbol As String = ci.NumberFormat.CurrencySymbol
    Label1.Text = CurrencySymbol
End If
you may want to loop through all provided languages to detect multiple currency characters - or at least loop till you find a valid one.
 
In that case the easiest way is probably to either ask / offer a configuration section and store their selection somewhere. If the browser isn't configured correctly then you have no way of knowing their settings.
This might just be possible if you used an ActiveX control on your web page - however this wouldn't work for any non-IE browser, non-windows platforms or if the user has quite sensibly decided to dis-allow ActiveX for security reasons.
 
Back
Top