Test cookie

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)
 
V

vMike

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top