Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

JSP Cookies

  • 04-04-2006 10:32am
    #1
    Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭


    This is a cookie i created, when i click logoff i want the cookies to be killed/deleted or its values set to null, which is the right way and best way to do it?
    Date now = new Date();
       String timestamp = now.toString();
       Cookie cookie = new Cookie ("username",username);
       cookie.setMaxAge(365 * 24 * 60 * 60);
       response.addCookie(cookie);
    


Comments

  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    any use?
    <%
         Cookie cookie = new Cookie("username", null);
         cookie.setMaxAge(0);
         cookie.setPath("/");
         response.addCookie(cookie);
    %>
    


  • Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    Whats this line do?
    cookie.setPath("/");
    


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    Its not necessary actually - I copied the code quickly from elsewhere.


  • Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    doesnt work, tired changing the code round, anyone else know??


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    Is my example removing the username value? Is it removing the max age value?
    What exactly is not working?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    nothin at all happens that i can see, the cookie is still alive and the pages all load fine, no changes!


Advertisement