This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I tried a simple counter that persists using a HttpSession object very similar to that in post 'Session Tracker' somewhat lower in the list. It works fine in Mozilla: refreshing increments the counter, upon opening a second browser the same counter (same ID) starts at the incremented value and after closing all windows and restarting the counter the value is also ok.
In internet explorer only refreshing (F5) works. Upon opening a second window a second counter is started (new session, new ID)! Two counters work in parallel now. After closing all windows and restarting a new counter (sessions) starts, too.
Does anybody recognize this behaviour and what setting in IE causes this behaviour? Thanks for answering, Marc
The have to press 'F5' is got to do with your browser settings, select 'Tools', 'Internet Options'. In the temporary files section on the general tab, select 'settings. Check here that your browser always looks for new versions of a page, rather than reading it from the cache.
In IE, the second window has to be opened by the first window
The reason for this has to do with the way IE shares cookies. Since the session is kept track of via a cookie, windows that share cookies will share a session, while windows that do not share cookies will not share the session.
Opening a new window from within the main window works fine indeed.
Then, I changed the setting as suggested to search always for a newer file. No caching. Upon opening a new window from the launch bar the counter has the correct value. But an F5 refreshing restarts the counter at its initial value. Strange. Further refreshing through F5 makes the counter increment as usual.
The applicability of a session object seems more limited than I'd hoped. In mozilla I can set the maxInactiveInterval at -1 (no automatic invalidation after a certain time), close all windows, restart the server and still the session persists (quite surprised that it holds even after restarting the server).