473,388 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

HttpContext.Current.Request.UserLanguages

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?
Nov 18 '05 #1
3 11328
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."

Nov 18 '05 #2
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.UserLanguag es.Length.ToString()%>
languages defined.&nbsp; Your first choice is:
<%=(string)HttpContext.Current.Request.UserLanguag es[0].ToString()%>.
</form>
</body>
</HTML>

Thanks!

Mark
Nov 18 '05 #3
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: mi****@online.microsoft.com.

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: mu****@murphysw.com (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: <e0**************************@posting.google.com >
References: <e0**************************@posting.google.com > <Rl**************@cpmsftngxa07.phx.gbl> 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: gr**********@google.com
NNTP-Posting-Date: Thu, 11 Dec 2003 01:58:49 +0000 (UTC)
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.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.leve l3.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 <%=(string)HttpContext.Current.Request.UserLanguag es.Length.ToString()%> languages defined.&nbsp; Your first choice is:
<%=(string)HttpContext.Current.Request.UserLanguag es[0].ToString()%>.
</form>
</body>
</HTML>

Thanks!

Mark


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Francois Malgreve | last post by:
hello guys, I have some helper class in my ASP.NET pplication who basically contains static methods. I used them as helper methods to do small jobs that I can use at many places in my code. ...
5
by: coollzh | last post by:
who can tell the detailed difference of: HttpRuntime, Context, HttpContext.Current sometimes, we can use Context Object instead of HttpContext.Current; sometimes, we can user HttpRuntime...
3
by: ad | last post by:
I find a line in a Web application like: myString=(string)HttpContext.Current.Items; I used to use myString=(string)Application; or myString=(string)ViewState; I know about the difference...
3
by: Steve Franks | last post by:
Is there a way I can extend the HttpContext or one of its subclasses to include a property that exposes a custom class of mine to all ASP.NET pages? More specifically, I'd like to use a...
4
by: Chad | last post by:
My app is blowing up when it attempts to retreive the local language settings of the user accessing the site.
2
by: Dave | last post by:
After some digging, I discovered HttpContext.Current.Session is null when trying to access a session variable, username, in my upload.cs code which is in the App_Code folder. I just determined...
4
by: msch-prv | last post by:
Hello. I am trying to use caching to populate a datalist. The select method of the associated objectdatasource calls up GetRecipePageByRecipeCatID() to request the proper data (I am using custom...
3
by: Brett R. Wesoloski | last post by:
I am having problems using HttpContext.Current.Request.Url.Host. I have some code that does this... if (HttpContext.Current != null) { subdomain = HttpContext.Current.Request.Url.Host; }
3
by: Madhur | last post by:
Hello I am delivering an asp.net 2.0 application to my customer. I need to know, If I need to check for the condition of HttpContext.Current to be null in my business logic. I have extensively...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.