Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Site Server cookies

Status
Not open for further replies.

moltar

Programmer
Mar 8, 2002
26
US
I needs to make all cookies that are created by Site Server disappear upon the user's exit from the website. Currently, the following cookie data remains when leaving the site via closing a browser:

ShopperManager%2F ShopperManager%2F=KWRLESQP3P9F9JRTCLQ3KVSK839GBX33
216.183.103.10/
1536
1162086400
30050975
2139644960
29611115
*

I can't find anyway to make the cookie totally disappear when a user closes their browser. Can anyone help? Thanks!
 
the cookie will expire at the end of the users session.
If it is not, set the .Expires value to the current date when you set the cookie.
eg:
Response.Cookie(cookie).Expires = Date()

_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
more so subtract a day form the date now that I think of that one

Response.Cookies(cookie).Expires = DateAdd("d",-1,Date())


_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
thanks onpnt for the quick replies!

unfortunately, this tact has been tried (expires with an old date) and it isn't working. even if it did (and it still might), I am not sure what the cookie names are for the data that is sticking. the first one looks obvious ("ShopperManager"?), but no effect takes place when trying to expire a cookie name of "ShopperManager". Changing the cookie name to "ShopperManager%2F" does nothing either.

this may simply be an issue of identifying the cookie names for all of this persistent data, or it may be more complicated than that?
 
if all the cookies need to be cleared then you can loop through the cookie collection and clear them all on a unload event to call a procesing script on the ASP side of things
eg:
For Each Item in Request.Cookies
point to the cookie as Response.Cookies(Item)
Next


then set the expires date to some past date
eg:
Response.Cookies(objCookie).Expires = DateAdd("yyyy",-10,Date())


if the expires setting is not working can you post where you are doing it. just due to it should work out correctly


_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
thanks, onpnt, the cookie is cleared out quite nicely. got a question on how to approach it from an "unload" event, though... is "unload" literally a javascript unload, or are you referring to something else? and what about handling it using an Application_OnEnd in global.asa?

thanks much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top