protected override void OnInit(EventArgs e) { base.OnInit(e); string script = "window.setTimeout(\"alert('Your session expired!');\", " + (Session.Timeout - 1) * 60000 + ")"; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "SessionManager", "<script language=\"javascript\">" + script + "</script>"); }
A directory of ASP.NET tutorials,ASP.NET Codebook, applications, scripts, assemblies and articles for the novice to professional developer
How To Add Session Timeout Popup in asp.net
If you need to alert a user that his session will time out. This is how to do it.
Add the following code snippet to the OnInit method on the base page of your application.
Subscribe to:
Post Comments (Atom)
thanx
ReplyDelete