[Last Call] Learn how to a build a cloud-first strategyRegister Now


Detecting Session and/or Authentication Timeout

Posted on 2006-04-26
Medium Priority
Last Modified: 2011-04-14
I have an ASP.NET application which is configured for Forms-based Authentication and has a simple Login.aspx page.  If a user's session or authentication times out, clicking on any of the application's links takes them immediately to the Login page.  This is fine, I can always adjust the timeout values if it gets too annoying.

However, I would like to display a message telling them what happened ("Sorry, your session timed out.  Please log in again.") because I'm sure there will be some (many?) users scratching their heads when this happens.  Is there a way to detect that the login.aspx page was invoked because of a timeout as opposed to a user loging in for the first time?
Question by:michaelrenda

Accepted Solution

dumbluck earned 375 total points
ID: 16548419
Sure, save a session cookie in the browser. It should exist for as long as the browser is open and expire when the browser closes (the default when no Expires timespan is set).

Author Comment

ID: 16666615
This works pretty well except when the user navigates away from the site and then returns.  Because the session cookie is still present, you can't tell the difference between this situation and a session timeout.  Still, it works 90% of the time

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 22 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question