Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help. Lcid code. 1

Status
Not open for further replies.

tyant

Programmer
Jun 1, 2001
68
AU
I was wondering if anybody could help me.
I am trying to get different pages to display depending on what country the user is from.


I've tryed this
<%
If lcid = 6153
Response.Redirect &quot;navn.htm&quot;
elseIf
Response.Redirect &quot;navm.htm&quot;
End If
%>


and this
<%
If getlocale(6153)
Response.Redirect &quot;navn.htm&quot;
elseIf
Response.Redirect &quot;navm.htm&quot;
End If
%>


and this
<%
If getlocale() = 6153
Response.Redirect &quot;navn.htm&quot;
elseIf
Response.Redirect &quot;navm.htm&quot;
End If
%>

Can any body Help!!! B-)

 
Use session.LCID to get the locale ID for the session.
 
I have tried


<%
select case session.LCID
Case 6153
Response.redirect &quot;navn.htm&quot;
case else
Response.redirect &quot;navm.htm&quot;
End Select
%>

this does not seem to work B-)
 
Add a response.write(session.LCID) to see what LCID is set to.

When you say it doesn't work, what happens. Does it always go to the navm.htm page, or does it fail to do anything?
 
response.write(session.LCID) does not work

In the session.lcid case statement it goes to navm.htm

Any other ideas?
B-)
 
If response.write(session.LCID) does not work, thats why your select case does not work. But I'm amazed that isn't working. Try this:

Create a new asp page called lcid.asp.

Edit the page and type the following:

<%
response.write(&quot;*&quot; & session.LCID & &quot;*&quot;)
%>

Try accessing this page from a number of browsers.

Do you see anything on screen, between the stars?

If you view source in IE, do you see anything or just the two stars?

Check in IE tools -> internet options general tab, languages. Does your browser have a language set?
 
I did that and I got 2048
The code for Ireland is 6153
B-)
 
I used the code in the website and I still cant seem to get it working.
Have you tried to do what I am saying?
B-)
 
his is then error I got


HTTP Error 404
404 Not Found

The Web server cannot find the file or script you asked for. Please check the URL to ensure that the path is correct.

Please contact the server's administrator if this problem persists
B-)
 
What file is it that it can't find, you asp page or the page you are redirecting to?

The code on the website is just an example. I would guess you would actually need to do something like this:

<%
Dim strAcceptLanguage
Dim strPos

strAcceptLanguage = Request.ServerVariables(&quot;HTTP_ACCEPT_LANGUAGE&quot;)

strPos = InStr(1, strAcceptLanguage, &quot;,&quot;)
If strPos > 0 Then
strAcceptLanguage = Left(strAcceptLanguage, strPos - 1)
End If

Select Case LCase(strAcceptLanguage)
Case &quot;en-ie&quot;
Response.Redirect &quot;navn.htm&quot;
Case else
Response.Redirect &quot;navm.htm&quot;
end select
%>

Make sure your navn.htm and navm.htm files are in the same directory as your asp.
 
Nice one. This code is working perfectly. I've been working on this for a while so thanks very much
B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top