Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cookie Redirection

2 views
Skip to first unread message

Sean

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to
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

Roman Rehak

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to
You need 2 files for this test.

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

Tim

unread,
Oct 1, 1998, 3:00:00 AM10/1/98
to
You should be able to use this:

<%'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 ?
>

Corbin Glowacki

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to
On Thu, 1 Oct 1998 12:57:15 +1000, "Sean" <No_Spam@Spam_Me_Not.com>
wrote:

>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
%>


0 new messages