For Programmers: Free Programming Magazines  


Home > Archive > ASP > July 2004 > Cookie Expires works in one instance, not another









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Cookie Expires works in one instance, not another
Alex Kail

2004-07-13, 3:55 pm

I have a site that you can only gain access to if you are logged in.
My sign in screen asks for your email address and password. If all
checks out, I write out information to a cookie (Cookie 1).

Some people on the site, myself included, are moderators of the site.
Moderator functionality is all over the site, so I created a toggle
button that will make the site pages look like everyone elses, with
the exception of this toggle button. The toggle uses a cookie,
basically the same code except the data being placed in the cookie is
different. (Cookie 2)

Cookie 1 code:
Response.Cookies("Member")("ID") =
CStr(rsLogin.Fields("Member_ID").Value)
Response.Cookies("Member").Expires = DateAdd("d", 365, Date)

Cookie 2 code:
Response.Cookies("Moderator")("Mode") = "ON"
Response.Cookies("Moderator").Expires = DateAdd("d", 365, Date)

As you can see, not much difference between the two, but the second
works fine. I have tried placing the Expires code ABOVE and BELOW, but
that doesn't work.

Any suggestions, please?
Alex Kail

2004-07-14, 3:55 am

It might have helped if I finished my post. The first cookie is acting
like a cokkie with no expiration date set (ie - it is lost when the
browser session is closed). I can get logged in OK, obviously, but
want the cookie to be preserved after the browser is closed.

Help, anyone.

Alex Kail
Alex Kail

2004-07-14, 3:55 pm

Never mind, I found the problem.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com