HttpContext.Current.Request.UserLanguages

M

MarkMurphy

In a barebones website with one page, checking
HttpContext.Current.Request.UserLanguages.Length in Page_Load of an
ASPX page in the VS IDE in codebehind shows a value of 1. Then when I
refresh the page with F5 from the browser it goes to the expected 16
-- the number of languages I have defined in IE6. I'm globalizing a
site and could swear this was working at one point. I use the value
at [0] to pick the user's language. On affected systems that will
default to English. The French Hate that ;-) It does not appear to
happen Netscape. It does happen across several client systems using
IE6.

Any ideas?
 
K

Kevin Yu [MSFT]

Hi Mark,

I have tried it on my computer, however, according to your statement, I
cannot repro it. Would you please provide me with more information such as
what operating system you're using, what version of IE you're using and
what version of VS .net you're working on?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
M

MarkMurphy

Hi Kevin,

As I mentioned, our site, www.windowsmobiletraining.com, detects the
users' selected language at the landing page, using
HttpContext.Current.Request.UserLanguages[0]. With a top setting of
'de' in IE, you should see the page in German. When I go there, I see
it in English, as some of our users report. Refresh <F5> sets it to
German. Others can see the German on the first try.

I'm running IE 6.0.2800.1106 with update versions SP1, Q810847,
Q813951, Q813489, Q818529, Q822925, Q828750, Q824145.


It may not be related, but if I set this page below as the start page
in the project and run the application in the IDE, the first view
shows 1 language. Refreshing shows 16. Running standalone in a
browser works the first time. It just makes me wonder if the
browser-related issue has some timing factor.

If I set this page as the start page in the project and run the
application in the IDE, the first view shows 1 language. Refreshing
shows 16.

<%@ Page language="c#"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>YourLanguage</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
Your browser has <%=(string)HttpContext.Current.Request.UserLanguages.Length.ToString()%>
languages defined.&nbsp; Your first choice is:
<%=(string)HttpContext.Current.Request.UserLanguages[0].ToString()%>.
</form>
</body>
</HTML>



Thanks!

Mark
 
M

Mike Moore [MSFT]

Hi Mark,

The next step in troubleshooting this is to determine if the problem is
with IE or with .NET. To find out, we need to look at the network traffic
that is being sent from IE. We want to check it to see if it contains all
the languages.

With this next step, I would like to work with you by direct e-mail. Can
you send me an e-mail? To get my address, remove "online." from my no spam
alias: (e-mail address removed).

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
From: (e-mail address removed) (MarkMurphy)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Re: HttpContext.Current.Request.UserLanguages
Date: 10 Dec 2003 17:58:49 -0800
Organization: http://groups.google.com
Lines: 48
Message-ID: <[email protected]>
References: <[email protected]>
NNTP-Posting-Host: 208.186.174.93
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1071107929 26449 127.0.0.1 (11 Dec 2003 01:58:49 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Thu, 11 Dec 2003 01:58:49 +0000 (UTC)
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!news-lei1.dfn.de!news-fra1.dfn.de!news2.telebyte.n
l!news-out.visi.com!petbe.visi.com!newsfeed2.dallas1.level3.net!news.level3.
com!postnews1.google.com!not-for-mail
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:195682
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi Kevin,

As I mentioned, our site, www.windowsmobiletraining.com, detects the
users' selected language at the landing page, using
HttpContext.Current.Request.UserLanguages[0]. With a top setting of
'de' in IE, you should see the page in German. When I go there, I see
it in English, as some of our users report. Refresh <F5> sets it to
German. Others can see the German on the first try.

I'm running IE 6.0.2800.1106 with update versions SP1, Q810847,
Q813951, Q813489, Q818529, Q822925, Q828750, Q824145.


It may not be related, but if I set this page below as the start page
in the project and run the application in the IDE, the first view
shows 1 language. Refreshing shows 16. Running standalone in a
browser works the first time. It just makes me wonder if the
browser-related issue has some timing factor.

If I set this page as the start page in the project and run the
application in the IDE, the first view shows 1 language. Refreshing
shows 16.

<%@ Page language="c#"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>YourLanguage</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
Your browser has
languages defined.&nbsp; Your first choice is:
<%=(string)HttpContext.Current.Request.UserLanguages[0].ToString()%>.
</form>
</body>
</HTML>



Thanks!

Mark
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top