Get your preferred culture / language information - C #, ASP.NET

I am trying to get my preferred language for users. I see all kinds of articles on how to install them, but they assume that the user says which language to choose (for example, from the drop-down list).

In Firefox, under "Tools"> "Options"> "Content"> "Languages"> "Select," you can choose which languages โ€‹โ€‹you prefer and choose their order. I want to have access to this list, or at least the preferred language in C # code. How can I do it? Is it possible?

Everything I tried always returns en-US, regardless of what is on the list.

+7
c # localization cultureinfo
source share
3 answers

I believe that after this

Request.UserLanguages 

From the documentation

"Gets a sorted string array of preferences in client languages.

+11
source share

I think the browser sends this in the Accept-Language header field, as documented by W3c . However, I'm not sure how to access this from ASP.net.

0
source share
 Dim userLocale userLocale=Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") Dim languages languages = Split(userLocale, ",", -1) 
0
source share

All Articles