|
Prevent Session Timeout in ASP.NET
|
|
Current Rating:
20%
Total Members Rated:
1 |
 |
private void Page_Load(object sender, System.EventArgs e) { this.AddKeepAlive(); } private void AddKeepAlive() { int int_MilliSecondsTimeOut = (this.Session.Timeout * 60000) - 30000; string str_Script = @" <script type='text/javascript'> //Number of Reconnects var count=0; //Maximum reconnects setting var max = 5; function Reconnect() { count++; if (count < max) { window.status = 'Link to Server Refreshed ' + count.toString()+' time(s)' ; var img = new Image(1,1); img.src = 'Reconnect.aspx'; } } window.setInterval('Reconnect()',"+ _ int_MilliSecondsTimeOut.ToString()+ @"); //Set to length required </script> "; this.Page.RegisterClientScriptBlock("Reconnect", str_Script); }
|
|
|
Author is online click the below eye to chat
|