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!

Redirect with this code 2

Status
Not open for further replies.

tyant

Programmer
Jun 1, 2001
68
AU
I have written code so that the page should redirect when it is loaded.

I am not sure how it works.
The page is called contindex.asp
The code is as follows


<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<%
If session.LCID = 1036 then
Response.Redirect &quot;contindexfre.htm&quot;
ElseIf session.LCID = 1040 then
Response.Redirect &quot;contindexita.htm&quot;
ElseIf session.LCID = 1034 then
Response.Redirect &quot;contindexspa.htm&quot;
ElseIf session.LCID = 2058 then
Response.Redirect &quot;contindexspa.htm&quot;
Else
Response.Redirect &quot;contindexeng.htm&quot;
End If
%>


This is exactly what I have. Is there ment to be something calling this to work or should the server automatically redirect with this code. B-)
 
I don't know about response.redirect, but I would use...

<%
If Session.LCID=1040 then
%>
<SCRIPT LANGUAGE=VBSCRIPT>
Window.Navigate &quot;contindexita.htm&quot;
</SCRIPT>
<%
ElseIf blah blah blah

Hope that helps...
G -GTM Solutions, Home of USITE-
-=
 
The code seems to work on my personal web server but when I upload it to the host server it does not work
The host server supports asp so there is no problem there.
Any other ideas.
 
This should work on IIS as I use this method regularly. The SCRIPT tag is run on the client and so should work regardless of server configuration. My guess is that your server does no support the session.lcid method. Try adding a Response.Write Session.LCID before the Ifs to see if you are actually picking up the LCID.

G -GTM Solutions, Home of USITE-
-=
 
Response.redirect should work fine, as long as you haven't got any html or response.write commands etc above this code.

However, all the elseif statements aren't good. Try this

<%
select case session.LCID
case 1036
Response.Redirect &quot;contindexfre.htm&quot;
case 1040
Response.Redirect &quot;contindexita.htm&quot;
case 1034
Response.Redirect &quot;contindexspa.htm&quot;
case 2058
Response.Redirect &quot;contindexspa.htm&quot;
case Else
Response.Redirect &quot;contindexeng.htm&quot;
End select
%>
 
I have changed the code to a Select Case Statement and it still does not work on the hosts server.
The Select Case Statement its self works so thanks for that iowtech .
I am currently looking in to wheather or not the host server can support the Lcid property.
If anybody else has any suggestions it wud b greatly appreciated B-)
 
tyant

What errors do you get when you try this?

Even if your server does not support the LCID property, it should at least redirect you to the contindexeng.htm page if you are using my code above.

Is contindexeng.htm in the same dirctory as this page?

what is the result of <%response.write(session.LCID)%>
 
I have checked out the code and it seems that its the host server does not support asp.
We have two hosts for two different websites and it works fine when I use the code on the NT server. The NT server supports asp and the code works like a dream
Thanx for all your help B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top