Foros de discusión
Clearing the cookies Programatically
venka reddy, modificado hace 9 años.
Clearing the cookies Programatically
Regular Member Mensajes: 231 Fecha de incorporación: 23/03/11 Mensajes recientes
Hi,
I want to logout the user programmatically. so i tried to clear the cookies as shown below code but still user is logged.
Any Suggestions to clear the cookies? Is anything wrong in the code?
Cookie[] cookies = actionRequest.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
cookies.setValue("");
cookies.setPath("/");
cookies.setMaxAge(0);
actionResponse.addProperty(cookies);
}
}
I want to logout the user programmatically. so i tried to clear the cookies as shown below code but still user is logged.
Any Suggestions to clear the cookies? Is anything wrong in the code?
Cookie[] cookies = actionRequest.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
cookies.setValue("");
cookies.setPath("/");
cookies.setMaxAge(0);
actionResponse.addProperty(cookies);
}
}
Archi Madhu, modificado hace 9 años.
RE: Clearing the cookies Programatically
Regular Member Mensajes: 237 Fecha de incorporación: 25/03/08 Mensajes recientes
I think you need to end session as well.
Try to look at what liferay does when user clicks on log out and try to replicate it.
Try to look at what liferay does when user clicks on log out and try to replicate it.