471,071 Members | 911 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Test cookie

I'm trying to test browsers for cookies. I have my browser set to prompt me
to accept cookies. As it is right now, I'm getting through whether I block
the cookie or not (no redirect). I'm deleting the files from my cookies each
time. Maybe it's just not as simple as it seems, can somebody suggest
something?

Response.Cookies("TestCookie").Value = "test"
Response.Cookies("TestCookie").Expires = DateTime.Now.AddMinutes(1)
If Request.Cookies("TestCookie") Is Nothing Then
Response.Redirect("nocookie.aspx")
Else
If Not IsPostBack Then
(Do something)
--

Jon Cosby

Please do not reply to this email address.
Nov 18 '05 #1
1 1125
Here are my experiences with cookies...
I believe that when you append a cookie, you can only test for it from
another page or from a complete reload of the page that is not a postback. I
also believe that if you are doing this from a localhost the cookie setting
is ignored. I am not positive of this though. One other thing, if you delete
the cookie you must close the browser before retrying your test. As I think
the cookies are still in memory.

"Jon Cosby" <qw****@nospam.net> wrote in message
news:cD******************@newsread2.news.pas.earth link.net...
I'm trying to test browsers for cookies. I have my browser set to prompt me to accept cookies. As it is right now, I'm getting through whether I block
the cookie or not (no redirect). I'm deleting the files from my cookies each time. Maybe it's just not as simple as it seems, can somebody suggest
something?

Response.Cookies("TestCookie").Value = "test"
Response.Cookies("TestCookie").Expires = DateTime.Now.AddMinutes(1)
If Request.Cookies("TestCookie") Is Nothing Then
Response.Redirect("nocookie.aspx")
Else
If Not IsPostBack Then
(Do something)
--

Jon Cosby

Please do not reply to this email address.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Aubrey Hutchison | last post: by
12 posts views Thread by George Hester | last post: by
3 posts views Thread by Stephanie Stowe | last post: by
4 posts views Thread by socialism001 | last post: by
reply views Thread by Sri. | last post: by
reply views Thread by Shapper | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.