Test cookie

  • Thread starter Thread starter Jon Cosby
  • Start date Start date
J

Jon Cosby

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)
 
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.
 
Back
Top