Solved

HTTP_ACCEPT_LANGUAGE - Redirect usage

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to dynamically set the form action using jQuery.

920 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

16 Experts available now in Live!

Get 1:1 Help Now