cookie expires..when i want it to stay :-(

Results 1 to 2 of 2

Thread: cookie expires..when i want it to stay :-(

  1. #1
    Join Date
    Dec 1969

    Default cookie expires..when i want it to stay :-(

    I am creating a cookie and trying to delete it an hour this...<BR> <BR>Response.Cookies ("CocoCookie").Expires = dateadd("h",1,now())<BR><BR>but it seems that the "Expires" method takes only "date" and not "time", and deletes the cookie right away , when the user closes the browser. i want the cookie to be there even if the user shuts down the browser incase he comes back in less than an hour. <BR>pls help....this is extremely urgent....<BR><BR>thanks in advance,,<BR><BR>ginni

  2. #2
    Join Date
    Dec 1969

    Default RE: cookie expires..when i want it to stay :-(

    Hi,<BR><BR>I&#039ve been thinking about expiring cookies in a similar way for a project recently but got a bit stuck because of the following:<BR><BR>When you use the now() function to set a cookie (or page) expiry date/time you are actually using the date/time value from the server and sending it to the client, which may be in a different time zone. In other words, sending a date/time based on the server value may well make no sense on the client because they&#039re +/-n hours.<BR><BR>The only way round this I can think of is to write a bit of client side VB/Jscript or a preceeding page which GET/POSTs the cleint date/time to the page which sets the cookie. Bit of a fiddle to say the least.<BR><BR>The real shame is that the cookies("x").Expires property is actually the functional equivalent of the response.ExpiresAbsolute property. Now, if the cookies collection supported an offset value as well as an absolute one we&#039d be laughing. Well, smiling maybe.<BR><BR>Hope this makes sense, and does apply to your problem, (are you in a different time zone to your server?). If anyone can put me straight or has any more thoughts on this it&#039d be great to hear them.<BR><BR>Jerome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts