Destroying cookies

Results 1 to 4 of 4

Thread: Destroying cookies

  1. #1
    John Findley Guest

    Default Destroying cookies

    I have a rather simple loggin mechanism in place, which stores a unique session ID inside a multy key-ed cookie. I use that session ID, along with some other values, to check out the user on every page. However, I ran into some problems when I tried to destroy the cookie ("logout" option). I used the following syntax:<BR><BR>Response.Cookies("cookieName") = "";<BR><BR>But it doesn&#039;t work!! After this code is executed, the useris still able to access other pages. Just to mention that the cookie expires after the current browser session.<BR><BR>The question is simple: what is wrong with my code?? How can I destroy all the values inside the cookie or make the cookie unavailable in some other way???<BR><BR>Thanks in advance...

  2. #2
    Join Date
    Dec 1969

    Default Try

    removing the semicolon in<BR><BR>Response.Cookies("cookieName") = ""; <BR><BR><BR>and see

  3. #3
    Join Date
    Dec 1969

    Default Here is what i use

    datYesterday = DateAdd("d", -1, Date())<BR>Response.Cookies("cookieName").Expires = datYesterday<BR>

  4. #4
    John Findley Guest

    Default RE: Here is what i use

    As for the first suggestion, I use JScript, so removing the semicolon would result in script error. As for the other, I tried that and it didn&#039;t work. However, when I set the Path property explicitly, it worked!!<BR><BR>Something like:<BR><BR>Response.Cookies("cookieName") = "";<BR>Response.Cookies("cookieName").Path = "/path/to/app/";<BR><BR>After this, it works almost like a charm! I don&#039;t know why is this so...

Posting Permissions

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