Response.redirect does not work properly....

anichothennaR

New Member
I am trying to redirect people with Netscape 4.0 browsers to a special page with the following code:<BR><BR><script language="vb" runat="server"><BR>Sub Page_Load(Source As Object, E as Eventargs)<BR> If Request.Browser.Browser = "NS" Then <BR> If Request.Browser.MajorVersion <6 Then<BR> Response.redirect("upgrade.html")<BR> Else<BR> Response.redirect("/directory_1/")<BR> End If<BR> End If<BR>End Sub <BR></script> <BR><BR>It works great with Netscape 6 and Navigator 4, but in IE 6, the page loads as a blank with the following source:<BR><BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><BR><HTML><HEAD><BR><META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD><BR><BODY></BODY></HTML><BR><BR>I am baffled and would appreciate your input!<BR><BR>Thanks,<BR>RobYou've enclosed your response.redirect statement inside your if statement that checks for netscape.. So you force it to be a NS browser in order for it to redirect...<BR>This would work<BR><BR><BR>Sub Page_Load(Source As Object, E as Eventargs)<BR>Dim redirectTO as String ' Where to redirect<BR><BR>If Request.Browser.Browser = "NS" Then<BR>If Request.Browser.MajorVersion <6 Then<BR> redirectTo = "upgrade.html"<BR>Else<BR> RedirectTo = "/directory_1/"<BR>End If<BR> ' removed redirect statement here... will only redirect if browser is netscape<BR>End If<BR><BR>Response.redirect(redirectTo)<BR><BR>End Sub
 
Back
Top