Solved

HTTP_ACCEPT_LANGUAGE - Redirect usage

Posted on 2004-08-31
4
451 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction and Prerequisites This article describes methods for detecting whether a client browser accepts and returns HTTP cookies and whether the client browser runs JavaScript.  Most client browsers will, by default, be configured to use cooki…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now