• Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting Cookies

 
Jack pero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am having a login page, with two fields, username and password and if the "remember me on this computer" check box is checked, i want to remember the credentials on the next login, for this i am able to do by creating cookies.
But now the problem is when next time when the user unchecks the "remember me on this computer" checkbox, the existing cookies should be removed, but i am not able to do this.
Please could any one help me with this.

Thanks in advance..
-Jack
"find a way, or make the one"
 
Rao Raghu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set the max age of cookies as zero like:


after confirming that the user has unchecked 'remember me'.
 
Jack pero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rao,
I already tried this thing, but its not working. Is there any other way to do so.

-Jack
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already tried this thing, but its not working.


That sounds like a bug in the servlet container, then, because the javadocs for Cookie say that setting the time to zero will delete it. Which container are you using?
[ February 21, 2007: Message edited by: Ulf Dittmer ]
 
Rao Raghu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to find out why that is not working? You can atleast find out that the user has checked the check-box or not. If next time he unchecks it, reset the cookie value to null.

Also go through this and this
 
Jack pero
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have tried the same thing, please find here the method i am using to delete cookies:


Thanks..
-Jack
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!