留言板
Clearing the cookies Programatically
venka reddy,修改在9 年前。
Clearing the cookies Programatically
Regular Member 帖子: 231 加入日期: 11-3-23 最近的帖子
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,修改在9 年前。
RE: Clearing the cookies Programatically
Regular Member 帖子: 237 加入日期: 08-3-25 最近的帖子
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.