I would like to redirect people to differnet page on my server using asp
cookies, if they have cookies enabled i would like them to enter the site if
not i would like then to be redirected to a differnet page. Could some body
tell me where i can find a tutorial that outlines redirection with .asp
cookies ?
Thank you iin advance for your answer
Sean Kerr
The first file, let's say test.asp should contain code that will set a
session variable and after a few seconds redirects to results.asp:
<HEAD>
<META HTTP-EQUIV="Refresh" content="3; URL=results.asp">
</HEAD>
<b>Baking cookies, please wait...</b>
<%
On Error Resume Next
Session("Test") = "cookie"%>
Then in results.asp check if the session variable still exists, if it
doesn't the browser doesn't support cookies:
<%
On Error Resume Next
If IsEmpty(Session("Test")) Then
Response.Redirect "nocookies.asp"
Else
Response.Redirect "whatever.asp"
End If %>
Roman
Roman Rehak, MCP (SQL Server)
Senior Software Engineer, 6 Degrees Software
http://www.together.net/~waitasec
<%'buffer the contents until the script has run completely%>
<% Response.Buffer=True %>
<% set bc = Server.CreateObject("MSWC.BROWSERTYPE")
if bc.cookies = false then
Response.Redirect "no_cookies.asp"
Else
Response.Redirect "cookies.asp"
End if
%>
<Response.Flush%>
Your html goes here....
Hope this helps..
Tim
Sean wrote in message ...
>Hello,
>
>I would like to redirect people to differnet page on my server using asp
>cookies, if they have cookies enabled i would like them to enter the site
if
>not i would like then to be redirected to a differnet page. Could some body
>tell me where i can find a tutorial that outlines redirection with .asp
>cookies ?
>
>Hello,
>
>I would like to redirect people to differnet page on my server using asp
>cookies, if they have cookies enabled i would like them to enter the site if
>not i would like then to be redirected to a differnet page. Could some body
>tell me where i can find a tutorial that outlines redirection with .asp
>cookies ?
>
>Thank you iin advance for your answer
>
>Sean Kerr
>
Try this
<title>check.asp</title>
<%
Response.Expires=0
strCookie = Request.Cookies("COOKIE")
strTry = Request.QueryString("Try")
If IsNull (strCookie) OR ( Len(strCookie) = 0) Then
' Check to see if this is a redirect after
' the cookie has been set
If IsNull (strTry) OR ( Len(strTry) = 0) Then
Response.Cookies("COOKIE") = "Set"
' Redirect to this page and try again.
Response.Redirect("check.asp?Try=Yes")
Else
' User or Browser didn't accept cookies
' Send them to a different page
Response.Redirect("nocookies.asp")
End If
End If
%>