Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

HTTP_ACCEPT_LANGUAGE - Redirect usage

Posted on 2004-08-31
4
455 Views
Last Modified: 2012-05-05
I have a website (www.X.com) that I have set up to support 8 languages.  Based on a query string I load up the correct languages string.  For instance:

www.X.com/about.asp?lang=fr will show French and www.X.com/about.asp?lang=de will show German

This works out great since the user can, if they need to, change langauges very quickly.

What I'd like to do, on the main page (www.X.com/default.asp) and that page only, is the first time teh page is loaded in that session, to guess what the language is and default the page to that.  

So by using Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") to get the language on www.X.com/default.asp, I'd like the page to refresh and somehow work like the others.  So if a user came to default.asp and their language was FR, it would show the French page but allow them to change if necssary.  The best way I figured so far is to, on www.X.com/default.asp, to a Response.Redirect to www.X.com/default?lang=fr 

BUT I thought while surfing the net, that Yahoo! and Google frown on redirects and I don't want to get the site penalized in search rankings.

Any ideas?

Thanks,
CS
0
Comment
Question by:csullins
  • 2
4 Comments
 
LVL 2

Expert Comment

by:SeanLWilliams
ID: 11946309
redirects are fine if your using them constructively IMO ,  or you  can look at Server.Transfer("url")  which doesn't hit the browser
0
 
LVL 2

Expert Comment

by:SeanLWilliams
ID: 11946326
0
 
LVL 1

Accepted Solution

by:
Buz earned 125 total points
ID: 11951439
Why redirect?

Assuming that your script checks for the value of request.querystring("lang") somewhere in the code, prior to any data display or DB query, all you need to do is: (Sorry for any syntax errors, haven't wrote ASP for a while)

if request.querystring("lang")="" then
  User_Lang = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
else
  User_Lang = request.querystring("lang")
end if

Now use User_Lang in your script as the page language.
0
 

Author Comment

by:csullins
ID: 11957830
That was perfect!  Thanks :)
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question