I am placing user data in the session then passing it to viewdata to view on a page. Now when my user walks away from his computer for a while, the session ends and the data
I use some Javascript in my MasterPage to redirect the user (after a prompt to renew the session) to the logout action. It uses an AJAX request back to the Home page of the app to refresh the server side session window when the user clicks the button in the dialog to extend the session. Relies on jQuery and jQuery UI for the dialog.
<% if (this.Request.IsAuthenticated)
{
int sessionDialogWait = 2 * 60 * 1000 - 60 * 500; // ms = 1.5 minutes
int sessionTimeout = 28 * 60 * 1000; // ms = 28 minutes
if (ViewData["sessionTimeout"] != null)
{
sessionTimeout = ((int)ViewData["sessionTimeout"] * 60 - 120) * 1000;
}
%>
<% } %>