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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Persistent cookies 1

Status
Not open for further replies.

Kingkumar

Programmer
Jan 21, 2003
167
0
0
US
Hi ,
I wanted to know how to create permanent cookies so that the information is not deleted until user desires too
i know one way is to
Response.Cookies("name").Expires = date() + 365*5
which i found in one of the forums but is there any other way also
what does this mean

Response.Expires = -1

thanks

--king
 
Thanks for your prompt reply Sheco.

does this means that page wont be cached at all ??
--King
 
Yes,

All of these mean not to cache the page:
Code:
Response.Expires = -1
Response.Expires = 0
Response.Expires = -1000

This sets the time in minutes the response should be cached for:
Code:
REsponse.Expires = 1
(or above, i.e. 30 / 90 / 100)

You can also use this if you want to set a specific date:
Code:
Response.ExpiresAbsolute = #June 10,2005 10:00:00#

or do it via HTML:
Code:
<META HTTP-EQUIV="Expires" VALUE="May 31,2001 13:30:15">


Hope that helps...
Damian



A smile is worth a thousand kind words. So smile, it's easy! :)
 
As you mentioned, the way to get cookies to persist is to set the expiration date to far in the future. If you don't do this, the cookie is deleted when the session ends, so it effectively acts as a session variable (but its value is stored on the client, not the server).

When you set the cookie to persist, the file remains as such: \Documents and Settings\username\Cookies\username@domain.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top