keep session alive in asp.net
Add below script in Master Page :
var count = 0; var max = 100; function Reconnect(){ count++; if (confirm('Session is going to expire in next 2 minutes. Click OK to keep the session alive.') == true) { window.status = 'Link to Server Refreshed ' + count.toString() + ' time(s)'; var img = new Image(1, 1); img.src = 'Reconnect.aspx'; } } $(document).ready(function() { window.setInterval(‘Reconnect()’, ((20 * 60000)) – 120000); //20 is the session time out set in the web config file. });
Add one aspx page in your application and replace whole page code with the following code :
<%@ Page Language="C#" %> <%@ OutputCache Location="None" VaryByParam="None" %> <html xmlns="http://www.w3.org/1999/xhtml"> </html>