in reply to perl CGI::Session not deleting the session

Your code example contains a mix of HTML and Perl, what's up with that?

Now even after this, if i click the browser back button, the session still exists. I'm able to view the Page2.

Are you sure the browser isn't just showing you a cached version of the page? Many modern browsers now have "web developer tools", which you can use to see if your browser is actually making a request to the server or not. In any case, you can get your CGI script to kindly ask the browser not to cache the page, see e.g. here.

If you find that the session really does still exist, then have a closer look at the documentation and other threads on this matter. For example, you may want to call $session->flush() after delete; other places suggest that simply $session->clear() is enough - note that a session existing is not necessarily the same as a user being logged in within that session.

Replies are listed 'Best First'.
Re^2: perl CGI::Session not deleting the session
by chandrakanth (Initiate) on Feb 21, 2015 at 09:50 UTC
    Are you sure the browser isn't just showing you a cached version of the page?
    >> To confirm this i just created a hyperlink to Page4 on the logout page. On page4 also i had the script to check if a session exists or not.. i'm seeing the same session id on Page4 too.

      You said you see the same session ID, which is not surprising since you're getting it from a cookie - or did you delete the cookie too? I think there is still some confusion here: Did you check if the session got deleted, such as by looking into the data store that holds the sessions, or by checking whether the session is empty or not? Also, are you equating a session existing with being logged in? Why do you need to delete the session, why isn't clearing it enough to effect the logout?