Forums

This topic is locked

Can't anyone help with redirection problem?

Posted 20 Mar 2003 09:29:02
1
has voted
20 Mar 2003 09:29:02 Phil Cue posted:
Hi,

I just can't seem to find a solution to this.

I want to redirect the following to the correct browser version:

www.mysite.com/test.asp?id=123


I have a browser detection page in the middle (using the Magicbeat server
behaviour 'detect browser and redirect') to Internet Explorer version
here:

www.mysite.com/test_ie.asp?id=123

note the difference: _ie

I'd be obliged if anyone could let me know how it is done, it's driving me nuts!

Thanks.

Replies

Replied 20 Mar 2003 09:38:19
20 Mar 2003 09:38:19 Phil Cue replied:
I've just realised the test URL I have used goes to some Auction site, sorry this was unintentional.

Phil
Replied 22 Mar 2003 18:12:40
22 Mar 2003 18:12:40 Phil Cue replied:
Come on guys and gals,someone must be clever enough!! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Or perhaps you really can't find a solution to it?
Replied 22 Mar 2003 22:50:29
22 Mar 2003 22:50:29 Brent Colflesh replied:
Wow, you've shamed us into it - good luck w/your future career - I'll have fries w/that...

Regards,
Brent

Replied 23 Mar 2003 12:09:01
23 Mar 2003 12:09:01 Phil Cue replied:
....Oh the shame.. <img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>

Do you want salt with your 'freedom fries'?

But seriously, I really thought someone must be clever enough to solve this problem, was I wrong? Are you all just talk? <img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>

I lay down the gauntlet, I challenge you, not only find a solution, but also to find it before 27th March (2003).

Look, I'll even include the code on the rediredtion page to help you all <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle> :

&lt;%
agent = Lcase(Request.ServerVariables("HTTP_USER_AGENT")
nslash = InStr(1,agent,"/",1)
name = Left(agent, nslash -1)
vers = Right(agent, Len(agent) - nslash)
if InStr(1,name,"mozilla",1) &gt; 0 Then
if InStr(1,agent,"spoofer",1) = 0 AND InStr(1,agent,"compatible" = 0 Then
name = "Netscape"
Else
If InStr(1,agent,"msie",1) &gt; 0 Then
name = "Microsoft"
End If
End If
End If
if InStr(1,name,"Microsoft",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ie.asp"
Else
If InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ns.asp"
Else
If InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 3.0 Then
Response.Redirect("index_ns.asp"
Else
Response.Redirect("index_gen.asp"
End If
End If
End If
'MagicBeat Server Behavior - 1023 - by Jag S. Sidhu - www.magicbeat.com
%&gt;
Replied 23 Mar 2003 13:45:00
23 Mar 2003 13:45:00 Owen Eastwick replied:
Did you think your shameless promotion of that site on this forum would go unnoticed. I'd have thought it unnecessary given that you make so much money on the auction sites. <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Replied 23 Mar 2003 14:18:03
23 Mar 2003 14:18:03 Phil Cue replied:
The auction site has nothing to do with me!!! I didn't expect that it would go anywhere, typical isn't it.

Alright let me give you another example:
www.myfookingsite.com/test_ie.asp?id=123 (this time I checked)

Now there, is that to your liking....? Still doesn't hide the fact that you have absolutely no idea how to to resolve this redirect problem. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

Now if you don't mind, this is a matter for serious people, with serious replies.
<img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle> <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Your adverts did not go unoticed, still that was your intention.
Replied 23 Mar 2003 17:10:01
23 Mar 2003 17:10:01 Owen Eastwick replied:
OK, try this:

&lt;%
agent = Lcase(Request.ServerVariables("HTTP_USER_AGENT")
nslash = InStr(1,agent,"/",1)
name = Left(agent, nslash -1)
vers = Right(agent, Len(agent) - nslash)
if InStr(1,name,"mozilla",1) &gt; 0 Then
if InStr(1,agent,"spoofer",1) = 0 AND InStr(1,agent,"compatible" = 0 Then
name = "Netscape"
Else
If InStr(1,agent,"msie",1) &gt; 0 Then
name = "Microsoft"
End If
End If
End If
If InStr(1,name,"Microsoft",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ie.asp"
Else If InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ns.asp"
Else If InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 3.0 Then
Response.Redirect("index_ns.asp"
Else
Response.Redirect("index_gen.asp"
End If
End If
End If
'MagicBeat Server Behavior - 1023 - by Jag S. Sidhu - www.magicbeat.com
%&gt;

Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Replied 23 Mar 2003 23:36:50
23 Mar 2003 23:36:50 Jeremy Conn replied:
Also, you might not want to place MagicBeat code on your post for everyone to see, especially as that is a purchased product.

(DWMX|IIS5|Access2K|XP|ASP/VB)
*Connman21*
www.conncreativemedia.com
Replied 24 Mar 2003 09:54:14
24 Mar 2003 09:54:14 Phil Cue replied:
Very big OOOHHPPS.

Thanks oeastwick I'll give it a try.


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Also, you might not want to place MagicBeat code on your post for everyone to see, especially as that is a purchased product.

(DWMX|IIS5|Access2K|XP|ASP/VB)
*Connman21*
www.conncreativemedia.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 25 Mar 2003 11:41:34
25 Mar 2003 11:41:34 Phil Cue replied:
No Owen what you have provided does'nt work either. It's also the same script. Thanks anyway. <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Any more ideas Owen or anyone?
Replied 25 Mar 2003 15:01:52
25 Mar 2003 15:01:52 Owen Eastwick replied:
Apologies, I didn't copy the code over properly, here you go:

&lt;%
agent = Lcase(Request.ServerVariables("HTTP_USER_AGENT")
nslash = InStr(1,agent,"/",1)
name = Left(agent, nslash -1)
vers = Right(agent, Len(agent) - nslash)
if InStr(1,name,"mozilla",1) &gt; 0 Then
if InStr(1,agent,"spoofer",1) = 0 AND InStr(1,agent,"compatible" = 0 Then
name = "Netscape"
Else
If InStr(1,agent,"msie",1) &gt; 0 Then
name = "Microsoft"
End If
End If
End If
if InStr(1,name,"Microsoft",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ie.asp"

' You could get rid of the follwing 2 lines, they won't have any effect as you are sending &gt;= 3.0 to the same page
ElseIf InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ns.asp"

ElseIf InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 3.0 Then
Response.Redirect("index_ns.asp"
Else
Response.Redirect("index_gen.asp"
End If '&lt;---- ONLY 1 "END IF" HERE
%&gt;


Notice:

ElseIf ......

Instead of:

Else
If ......

Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/

Edited by - oeastwick on 25 Mar 2003 15:07:26
Replied 25 Mar 2003 16:17:35
25 Mar 2003 16:17:35 Phil Cue replied:
No luck Owen tried it still the same problem. Difficult one huh?
Replied 25 Mar 2003 18:27:47
25 Mar 2003 18:27:47 asp asp replied:
well owens code seems fine, maybe you browser is broken??? <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 25 Mar 2003 19:10:41
25 Mar 2003 19:10:41 Phil Cue replied:
Yes the code works when I dont want to go to a particular record like this:

www.myfookingsite.com/test_ie.asp

That's never been a problem. It's when I do want to go to a specific record that's the problem, eg:
www.myfookingsite.com/test_ie.asp?id=123

<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 25 Mar 2003 20:03:28
25 Mar 2003 20:03:28 Owen Eastwick replied:
No problem:

&lt;%
varID = Request.QueryString("id"
agent = Lcase(Request.ServerVariables("HTTP_USER_AGENT")
nslash = InStr(1,agent,"/",1)
name = Left(agent, nslash -1)
vers = Right(agent, Len(agent) - nslash)
if InStr(1,name,"mozilla",1) &gt; 0 Then
if InStr(1,agent,"spoofer",1) = 0 AND InStr(1,agent,"compatible" = 0 Then
name = "Netscape"
Else
If InStr(1,agent,"msie",1) &gt; 0 Then
name = "Microsoft"
End If
End If
End If
if InStr(1,name,"Microsoft",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ie.asp?id=" & varID)

' You could get rid of the follwing 2 lines, they won't have any effect as you are sending &gt;= 3.0 to the same page
ElseIf InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 4.0 Then
Response.Redirect("index_ns.asp?id=" & varID"

ElseIf InStr(1,name,"Netscape",1) &gt; 0 AND CSng(Left(vers,3)) &gt;= 3.0 Then
Response.Redirect("index_ns.asp?id=" & varID"
Else
Response.Redirect("index_gen.asp?id=" & varID"
End If '&lt;---- ONLY 1 "END IF" HERE
%&gt;


Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Replied 27 Mar 2003 18:59:05
27 Mar 2003 18:59:05 Phil Cue replied:
Thanks Owen all solved.

For future reference to all, here's what was added:

Response.Redirect("index_ie.asp" & "?id=" & Request.querystring("id")

Cheers. Live long and prosper. <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 28 Mar 2003 22:13:57
28 Mar 2003 22:13:57 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I've just realised the test URL I have used goes to some Auction site, sorry this was unintentional.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
And a bad one at that <img src=../images/dmxzone/forum/icon_smile_angry.gif border=0 align=middle>

with kind regards,

Dennis van Galen
DMXzone Manager
FAQ, Tutorial and Extension Manager


Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5

Reply to this topic