ASP Cookies

liunx

Guest
simple task, strange problem.

i'm trying to use ASP cookies to replace ASP session objects. Wherever i created a session object, i put a Reponse.Cookies("cookiename")="cookievalue" (this was only done once, and it was indeed before the <html> tag)

then to refer to them i do Request.Cookies blah blah

anyway it seems to work just like a session - temporarily. once i close the browser it's lost. and if i look in my cookies folder i don't see any cookies created. What's going on? I tried this both on a localhost and on the server, both dont create cookies.

any ideas?

EDIT: Okay in firefox i can SEE the cookies. But when i close the browser, the one i created disappears. Only the ASPIDSTART one stays.... how do i make a 'permanent' cookie that doesn't go away on browser close?Are you setting an expiration date?No.. lol. I was wondering about that..

Is there a way to specify a time period rather than a specific date?

EDIT: i guess i can just use the date() function, modded a bit

ThanksSure...

Response.Cookies("User_Info").Expires = Now() + 100
// it sets the expiration date 100 days from the current date

Borrowed from <!-- m --><a class="postlink" href="http://www.thecodeproject.com/asp/chocolatechipcookies.asphehe">http://www.thecodeproject.com/asp/choco ... es.asphehe</a><!-- m --> i went through all the trouble of

Response.Cookies("usertype").Expires= DateAdd("d",7,now())

Eh :xLive and learn...always a simpler way. :)Then, if you want to remove the cookie even if the browser remains open (e.g., user logs out of your site):

Response.Cookies("User_Info").Expires = Now - 1
 
Back
Top