AspNetAtoms.com daily updates on ASP.NET Tutorials, Articles, Authors and more. Subscribe to our newsletter and receive updates on ASP.NET resources on the Internet.

Categories

Recent Posts

Build an ASP.NET Session Timeout Redirect Control : Peter A Bromberg

Thursday, December 11 2008

It is often important for the business logic of an ASP.NET site to know for a particular request if the user’s session information is valid (e.g., a timeout has not occurred). Without this technique it is difficult to know, when a session variable is not found, whether it was never set properly or that the user simply waited too long between requests. This solution provides a simple, effective "drop on the page" control to handle this. We often get forum posts here asking "How can I tell if a user's Session is timed out, and perform some action in response?" Often this involves the incorrect assumption that the Session_End event can be used for this. ASP.NET implements a rolling timeout mechanism that extinguishes the session information for a user if no request is received within the timeout period. Session_End happens on the server automatically regardless of whether a user has requested a page, so the idea of using it to do anything other than cleanup-type operations is a mistake; it is independent of the page lifecycle and there is no active Request or Response object to access there....

Read More:
Build an ASP.NET Session Timeout Redirect Control : Peter A Bromberg
Also See:
SumColumn: Custom DataGrid Column that automatically shows Sum/Count/Average in DataGrid Footer. : Aziz ur Rahman
A Look at ASP.NET 2.0's URL Mapping : Scott Mitchell
Working with Email using ASP.NET 2.0 : Jason N. Gaylord
Which Path would you travel? A few points about ASP.NET Paths : Xun Ding

Post your comment

Comment