Friday, March 29, 2013

Get Browser default Language-C#

To find the browser's default language through C# you can use the below code


string [] arrayVariable = HttpContext.Current.Request.UserLanguages;

It returns an array .Since the browser might be having more than one language as preferences .
To get the default preference just pick the first entry of the array

string defaultLangauage = a[0].ToString();

No comments:

Post a Comment