Keeping a Session Alive

waveformIt seems like such a simple thing, I’m amazed it’s not part of Microsoft’s whole webform architecture. I would like to keep a user’s session from timing out as long as he/she is still on the web page. Just ping the server, so to speak, periodically, to let it know that this session is still being used, even if the user has gone to lunch, gotten interrupted by a phone call or coworker, etc.

I’ve tried numerous ’solutions’ that I have googled (jQuery heartbeat plugin, other javascript based things, AJAX controls, etc), but the only one I’ve gotten to work, is also about the simplest one I could find. It’s by Thomas Kurek and posted on Code Project.

http://www.codeproject.com/KB/session/Session_Defibrillator.aspx

So far, it has kept a session alive for over 16 hours. Keeping my fingers crossed that this one will be ‘the one’.

  • Share/Bookmark

About the Author

David is an IT professional with over 26 years of experience (he started his career as a teenager). He has programmed in more languages and on more types of computers (and similar devices) than he can remember, including TRS-80 Model I Level 2, Commodore Vic-20 and C-64, C-128, Industrial Process Controllers, CP/M machines, and Intel 80x86+ architectures. He currently uses Microsoft .NET Framework tools and SQL Server. When he's not geeking out, he studies the Martial Art, Aikido; engages in community volunteer work; writes fiction (as well as non-fiction blogs); and does home rennovation work. He lives in Charlotte NC, USA.