You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/07/30 19:38:06 UTC

Cookies not getting deleted

Hi,

I am trying to delete 2 cookies by using the code:


                            *Cookie emailIdCookie = ((WebRequest)
getRequestCycle()
							.getRequest()).getCookie("emailId");

					Cookie passwordCookie = ((WebRequest) getRequestCycle()
							.getRequest()).getCookie("password");

					if (emailIdCookie != null && passwordCookie != null) {

						emailIdCookie.setMaxAge(0);
						((WebResponse) getRequestCycle().getResponse())
								.addCookie(emailIdCookie);

						passwordCookie.setMaxAge(0);
						((WebResponse) getRequestCycle().getResponse())
								.addCookie(passwordCookie);

					}
*

But they are not being removed. I have seen a post related to it but the
person missed out path setting of the cookie. In my case,I am not setting
any path. Do I need to set it? 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cookies-not-getting-deleted-tp4650876.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Cookies not getting deleted

Posted by kshitiz <k....@gmail.com>.
Thnx..:) It is working now...we need to set path then...



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cookies-not-getting-deleted-tp4650876p4650880.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Cookies not getting deleted

Posted by Ian Marshall <Ia...@GMail.com>.
As well as setting the max age to zero, I also set the cookie's path to "/".


kshitiz wrote
> 
> Hi,
> 
> I am trying to delete 2 cookies by using the code:
> 
> 
>                             *Cookie emailIdCookie = ((WebRequest)
> getRequestCycle()
> 							.getRequest()).getCookie("emailId");
> 
> 					Cookie passwordCookie = ((WebRequest) getRequestCycle()
> 							.getRequest()).getCookie("password");
> 
> 					if (emailIdCookie != null && passwordCookie != null) {
> 
> 						emailIdCookie.setMaxAge(0);
> 						((WebResponse) getRequestCycle().getResponse())
> 								.addCookie(emailIdCookie);
> 
> 						passwordCookie.setMaxAge(0);
> 						((WebResponse) getRequestCycle().getResponse())
> 								.addCookie(passwordCookie);
> 
> 					}
> *
> 
> But they are not being removed. I have seen a post related to it but the
> person missed out path setting of the cookie. In my case,I am not setting
> any path. Do I need to set it?
> 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cookies-not-getting-deleted-tp4650876p4650877.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org