Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Remove Cookies?

 
Dean Chester
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have now decided to manage my sessions manually thanks to everyone that tried to help. I generate a random UUID write that to the database then the UUID is stored in a cookie which is then checked in the filter which gets the cookie and checks to see if it is in the database. I just now want to know if there is a way that i could remove the cookie(as in a logout thing) from the computer. The way i was considering was to just set the max age to 1 whenever log out was clicked as i have set no expiry on the cookies how it is, so it removes the cookie when you exit the browser.
Thanks in Advance
Dean
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach is correct. Just retrieve the cookie from the request, set MAX-AGE to 0 and add the cookie to the response object.

I wonder though why you store this UID as a cookie. Why not using a plain old session attribute?
 
Dean Chester
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check my older post on sessions LOL the trouble ive have had.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sessions are used by hundreds of thousands of web apps successfully. If you feel the need to "roll your own" you're probably just using them incorrectly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!