views:

947

answers:

3

Does hitting the back button in a web browser cause the session data set in the preceding call to be deleted?

+3  A: 

No, it does not.

Well, if the user arrived to the previous page by POST (as opposed to GET) and reposts the page, the server is going to process the request again. It won't delete the data in the session though. It is possible to achieve this behaviour with some code, but that's not how it works by default.

DrJokepu
A: 

No. It just causes the browser to either send again what it just sent to the server, or it will cause the browser to fetch the page from its cache, without interacting with the server at all.

Corey Trager
+1  A: 

Server-side session data is handled by the web framework, so behavior may differ. However almost all frameworks map session data to cookies, which are not lost when using the back button.

Some frameworks may however encode session ID's in URL's rather than in cookies (often as a fall-back if the browsers doesn't support cookies), and in that case the browsers may lose the session id, if it "backs" out.

JacquesB