Cookie only writes when form is submitted, not whe

Results 1 to 3 of 3

Thread: Cookie only writes when form is submitted, not whe

  1. #1
    Join Date
    Dec 1969

    Default Cookie only writes when form is submitted, not whe

    Hello,<BR>I&#039m writing my cookie like this:<BR><BR><BR> IF REQUEST.COOKIES("cookiename") = "" THEN<BR><BR> Response.Cookies("cookiename")("subcookie") = "0"<BR><BR> Response.Cookies("cookiename").Expires = #January 01, 2002#<BR> RESPONSE.REDIRECT "otherpage.asp"<BR> END IF<BR><BR>This cookie stays in the browser cache and I can use it to my hearts content, but it never writes to the cookie folder even when I close my browser down. If the user goes to my form page and hits submit, the cookie does write, which is great, but I still need the cookie to exist if the page has been viewed at all. I&#039ve tried it on multiple machines, I thought maybe it was the response.redirect at the end, but to no avail. If anyone knows what&#039s going on, I&#039d love it.<BR><BR>Thanks a lot,<BR>M:)

  2. #2
    Steve Cimino Guest

    Default RE: Cookie only writes when form is submitted, not

    Here&#039s a response from Atrax, awhile back:<BR>---------------------------------------------------<BR><BR>Cookies are set by the browser on receipt of a successful http response (200 response code)<BR><BR>what response.redirect does is overrides this 200 and sends a 302 (object moved) response. therefore you can&#039t set cookies and then response.redirect to another page, as the cookie will never get set<BR><BR>you could send a meta refresh tag to the browser in place of the redirect, but you&#039re not guaranteed that&#039ll work. likewise for using a piece of javascript to redirect after a 200 (cookie setting) response - but you&#039d have to use one of those methods, and write a text link to be on the safe side which just says &#039redirecting..&#039

  3. #3
    Join Date
    Dec 1969

    Default STEVE You're the greatest!

    I swear I tried that, but I&#039m under such a time crunch right now, who knows where my brain is. Thanks oodles!!<BR><BR>M:)

Posting Permissions

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