Issue with Cookies not getting deleted even after setting a previous date in expires property

T

techie

I am using the following to delete the contents of a cookie

Response.Cookies("maincookie").expires = DateAdd("d",-2,now)
Response.redirect "login.asp"

If i try to alert the value of the cookie in the same page, it shows
the old value. As well as when it is alerted from the login.asp it
shows the old value.
The problem is when i try to update the value of the cookie in the
login page, it does not update the new value.
Only if i close the browser and reopen, the new value gets updated and
even if the old value is originally present in the cookie.
I am specifying the domain and path when creating the cookie. the
expires property is set to date + 1 when creating.

What should be done to delete the contents of the cookie? Should i
specify the domain as well as path when changing the expires property?
Thanks in advance
 
C

Curt_C [MVP]

I suspect the page/site info is being cached. Try putting the "no cache"
code into your page(s).
 
T

techie

Thanks for your response.
I have the "no cache" code already in the files.
The main problem is that as soon as i update the value of the cookie
and alert it.. its shows updated value.. but in the following pages it
still uses the old value unless i close the browser and re-open.
 
C

Curt_C [MVP]

where is the cookie "read" in? on the other page or ?

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------


techie said:
Thanks for your response.
I have the "no cache" code already in the files.
The main problem is that as soon as i update the value of the cookie
and alert it.. its shows updated value.. but in the following pages it
still uses the old value unless i close the browser and re-open.



"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top