Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (!this.IsPostBack)
{
Session["Reset"] = true;
Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config");
SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState");
int timeout = (int)section.Timeout.TotalMinutes * 1000 * 60;
ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true);
}
---------------------------------------------------------------------
<script type="text/javascript">
$(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
title: "Session Expiration Warning",
buttons: {
"Extend Session": function () {
ResetSession();
},
Logout: function () {
CloseSession();
},
Close: function () {
$(this).dialog('close');
}
}
});
});
function SessionExpireAlert(timeout) {
var seconds = timeout / 1000;
$("#seconds").html(seconds);
setInterval(function () {
seconds--;
$("#seconds").html(seconds);
}, 1000);
setTimeout(function () {
$('#dialog').dialog('open');
}, timeout - 900 * 1000);
setTimeout(function () {
window.location.href = "../../../User/SessionExpired";
}, timeout);
};
function ResetSession() {
window.location = window.location.href;
};
function CloseSession() {
window.location.href = "../../../User/SessionExpired";
};
</script>
What I have tried:
when internet connection slow then pop up open before 900 second how to open pop up exact 900 seconds