NEED TO KEEP MY COOKIES

1

1995 Cobra

Hello all. I have no problems setting a cookie on a users machine and
retrieving it. My problem is that when they start a new session the
cookie is there, but cannot be retrieved. Is there a way to maintain
the cookie even if they browse the site in multiple sessions?

Thank you
 
A

Andy Dingley

Is there a way to maintain
the cookie even if they browse the site in multiple sessions?

Send them a persistent cookie - basically the same code on the server,
but you send an explicit expiry time with it too. The browser will
then keep the cookie until then (if the user allows it). This time can
be a long time in the future,

Assuming you're using PHP, then read this <http://www.php.net/manual/
en/function.setcookie.php>

It's good practice to only store persistent cookies for a "reasonable"
time, not 30 years. Especially if the cookie is either security-
critical, or for a fairly trivial purpose.
 
1

1995 Cobra

Send them a persistent cookie - basically the same code on the server,
but you send an explicit expiry time with it too. The browser will
then keep the cookie until then (if the user allows it). This time can
be a long time in the future,

Assuming you're using PHP, then read this <http://www.php.net/manual/
en/function.setcookie.php>

It's good practice to only store persistent cookies for a "reasonable"
time, not 30 years. Especially if the cookie is either security-
critical, or for a fairly trivial purpose.

Thanks. I am using .asp and vbscript. Even if I explicitly set an
expiration date for the future my cookie is not retrievable when a new
session is created. For instance... one goes to the site and the
cookie is set (to expire days from now). They close their browser and
return later. The cookie is there, but I cannot retrieve it. Any
thoughts?
 
J

Jonathan N. Little

1995 said:
Thanks. I am using .asp and vbscript. Even if I explicitly set an
expiration date for the future my cookie is not retrievable when a new
session is created. For instance... one goes to the site and the
cookie is set (to expire days from now). They close their browser and
return later. The cookie is there, but I cannot retrieve it. Any
thoughts?

If it is there, how do you know if you cannot retrieve it? Are you
talking about cookies or sessions. Basically cookies are on the client
(memory or disk) and sessions are on the server...
 
1

1995 Cobra

If it is there, how do you know if you cannot retrieve it? Are you
talking about cookies or sessions. Basically cookies are on the client
(memory or disk) and sessions are on the server...

If I go in to the cookies on the browser I can see it, but if I try to
access from the site it is gone. Other sites seem to not have this
issue, but I can't get around it. Thanks for any help.
 
A

Adrienne Boswell

Gazing into my crystal ball I observed 1995 Cobra <[email protected]>
writing in @m44g2000hsc.googlegroups.com:
If I go in to the cookies on the browser I can see it, but if I try to
access from the site it is gone. Other sites seem to not have this
issue, but I can't get around it. Thanks for any help.

You are getting OT for this group. More help available at
microsoft.public.inetserver.asp.general. Followups set.

Can you show us your code?
 
N

Nik Coughlin

1995 Cobra said:
Hello all. I have no problems setting a cookie on a users machine and
retrieving it. My problem is that when they start a new session the
cookie is there, but cannot be retrieved. Is there a way to maintain
the cookie even if they browse the site in multiple sessions?

Thank you

http://preview.tinyurl.com/4bfggq
 
1

1995 Cobra

Need to press that key once above the left shift key ;-)

Hey all, sorry was out over the weekend. Code is simple like...

response.cookies("name") = "whatever"
response.cookies("name").Expires = whenever

then a simple request.cookies("name")

Switching languages is not really an option at this juncture.

thanks for all the posts.
 

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
474,102
Messages
2,570,645
Members
47,243
Latest member
CorrineCad

Latest Threads

Top