<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Not the most elegant solution, but it works for me.<div><br></div><div>1) I have Catalyst using ACL rules to redirect to a login page if the session has expired.</div><div>2) The login page adds a response header (Login =&gt; 1).</div><div>3) Every Ajax call checks if it has received the special login page header (i.e., if it has been redirected to the login page).</div><div>4) If the <span class="Apple-style-span" style="text-decoration: underline;">Ajax</span> call has been redirected to the login page, it forces a <span class="Apple-style-span" style="text-decoration: underline;">top</span> level redirect to the login page (because I've got a bunch of smaller panes controlled by Ajax).</div><div><br></div><div>This is nice because I don't need the client to parse every page for a string like, "Please log in again." It's a simple lookup in the header. And it does what John suggested below in not polling the server unnecessarily. This method also supports user having multiple windows open because the server remains the arbiter of when the session has expired, not the client.</div><div><br></div><div>-steve</div><div><br></div><div><br></div><div><div>On Mar 3, 2010, at 2:57 PM, Steve Kleiman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hey John. Thanks for the feedback.<br><br>Yeah, it seems simple, but accommodating multiple windows is where I have problems. That's why I figured the way out was to poll the server every 3-5 minutes of idle time to see if user had been logged out.<br><br>Which brings me back to the original conundrum...asking the server, "Is your session expired yet?"<br><br>-s<br><br><br>On Mar 3, 2010, at 10:51 AM, John Karr wrote:<br><br><blockquote type="cite">The more I think about this, the more problems I see with my idea, you need to either restrict your users to one browser window (possibly with a secondary page key of some sort) or have the refresh bounce to an alternate uri that refreshes the page without updating the server's session timer.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Never mind, that's too simple. It breaks if users open up multiple pages unless you increase the refresh to just over twice the timeout, which may be an issue since presumably you don't want your user's expired sessions hanging around in their browser. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Even simpler put a refresh tag in the page with a refresh a little over the session timeout value, then the site's handler for expired sessions can do the rest.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-----Original Message-----<br></blockquote><blockquote type="cite">From: Alexander Hartmaier [mailto:alexander.hartmaier@t-systems.at] <br></blockquote><blockquote type="cite">Sent: Wednesday, March 03, 2010 10:03 AM<br></blockquote><blockquote type="cite">To: The elegant MVC web framework<br></blockquote><blockquote type="cite">Subject: Re: [Catalyst] Check session expiry without extending it<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Why not return the datetime when the session expires with every page and<br></blockquote><blockquote type="cite">have a client-side js that does the redirect without hammering the<br></blockquote><blockquote type="cite">server?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite">Best regards, Alex<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Am Dienstag, den 02.03.2010, 21:43 +0100 schrieb Steve Kleiman:<br></blockquote><blockquote type="cite"><blockquote type="cite">Using Catalyst::Plugin::Session with Session::State::Cookie.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Would like to be able to poll server if the user's session has expired WITHOUT extending the session itself.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The objective is to have a javascript periodical executor check if a session is expired and redirect user to a "Your session has expired" page if appropriate. Could do it in javascript but would prefer doing it on server.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Anyone tried this?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks in advance.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-Steve Kleiman<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*<br></blockquote><blockquote type="cite">T-Systems Austria GesmbH &nbsp;&nbsp;Rennweg 97-99, 1030 Wien<br></blockquote><blockquote type="cite">Handelsgericht Wien, FN 79340b<br></blockquote><blockquote type="cite">*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*<br></blockquote><blockquote type="cite">Notice: This e-mail contains information that is confidential and may be privileged.<br></blockquote><blockquote type="cite">If you are not the intended recipient, please notify the sender and then<br></blockquote><blockquote type="cite">delete this e-mail immediately.<br></blockquote><blockquote type="cite">*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br></blockquote><blockquote type="cite">Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br></blockquote><blockquote type="cite">Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br></blockquote><blockquote type="cite">Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br></blockquote><blockquote type="cite">Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br></blockquote><blockquote type="cite">Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br></blockquote><blockquote type="cite">Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote><br></div></blockquote></div><br></body></html>