Emailid
Password
         
  
    Forgot password

New user Sign Up
 

Prevent Session Timeout in ASP.NET

       Current Rating:  20%                                                     Total Members Rated:  1
                                                                     Send To Friend

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); 
 }
 


                           Rate This Article:   

Author is online click the below eye to chat
  Author: Sunil Dhiman
       


Comments Posted
Label
Subject Author Status Date

Good code!

Peechccaro Teindano 08/07/2008

 

Post Comment

Related Articles
N-Tier in ASP.NET or other .NET apps
Software Development Outsourcing (Offshore ) to India
Make your web site ‘perfect and Search Engine Friendly for Google and Yahoo
Color combination of your Web site
An appealing design for your Web site



Home | About Us | Site Map | Privacy Policy