Solved

HTTP_ACCEPT_LANGUAGE - Redirect usage

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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