Problem: I am looking to create a time-out warning message on an asp.net page with a c# code behind based off my webconfig sessionState TimeOut Attribute.
Code on w
Pseudo code:
setTimeout
passing the timeout period (20 * 60))Sample code:
public void RegisterTimeoutWarning(System.Web.UI.Page Page)
{
var timeout = HttpContext.Current.Session.Timeout * 60 * 1000;
Page.ClientScript.RegisterStartupScript(Page.GetType(),
"timeoutWarning",
string.Format("setTimeout(function () {{ alert('Session about to expire'); }}, {0});", timeout), true);
}
Of course, you can improve the client side display (rather than showing an alert) by displaying warning popups or even a confirm popup which you can then use to renew the session.