Dim msgSession As String = "Warning: Within next 3 minutes, if you do not do anything, our system will redirect to the login page. Please save changed data.!" Dim int_MilliSecondsTimeReminder As Integer = (Me.Session.Timeout * 60000) - 3 * 60000 'time to redirect, 5 milliseconds before session ends Dim int_MilliSecondsTimeOut As Integer = (Me.Session.Timeout * 60000) - 5 Dim str_Script As String = vbCr & vbLf & "var myTimeReminder, myTimeOut; " & vbCr & vbLf & " clearTimeout(myTimeReminder); " & vbCr & vbLf & " clearTimeout(myTimeOut); " & "var sessionTimeReminder = " & int_MilliSecondsTimeReminder.ToString() & "; " & "var sessionTimeout = " & int_MilliSecondsTimeOut.ToString() & ";" & "function doReminder(){ alert('" & msgSession & "'); }" & "function doRedirect(){ window.location.href='Login.aspx'; }" & vbCr & vbLf & " myTimeReminder=setTimeout('doReminder()', sessionTimeReminder); " & vbCr & vbLf & " myTimeOut=setTimeout('doRedirect()', sessionTimeout); " System.Web.UI.ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "CheckSessionOut", str_Script, True)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)