I'm not sure if I understand this code or I use it correctly, but I got the impression that on ASP.NET 2.0 AJAX I can run javascript, for example:
var c = Sys.CultureInfo.CurrentCulture
and this will give me the culture / language settings that the user specified in his browser during the visit. However, for me it always returns "en-US" no matter what language I choose in firefox or IE.
This server code is:
string[] languages = HttpContext.Current.Request.UserLanguages;
if (languages == null || languages.Length == 0)
return null;
try
{
string language = languages[0].ToLowerInvariant().Trim();
return CultureInfo.CreateSpecificCulture(language);
}
catch (ArgumentException)
{
return null;
}
returns the language that I currently installed. But I need to do this clientide, because I need to parse the string in datetime and do some checks before I go back, and the string could be MM / DD / YYYY or DD / MM / YYYY or some other such thing.
What am I missing?
EDIT:
, http://www.datejs.com/. , , . , js . , serveride script include, . ASP.NET AJAX? serveride ( ) Sys.CultureInfo.CurrentCulture js ? , .