TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mukesh
NA
228
42.7k
Pop up time showing wrong
Jun 1 2021 7:05 AM
Hi i am trying to open popup session expire before 15 min but when i set 120 min in webconfig then minutes is showing wrong minutes
so please help me
What I have tried:
$(
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
minutes = timeout / 1000/60-1;
var
seconds = 59;
$(
'#seconds'
).html(minutes +
':'
+ seconds);
var
interval = setInterval(
function
() {
//var timer2 = $("14:59");
//var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
//var minutes = 14;
//var seconds = 59;
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if
(minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ?
'0'
+ seconds : seconds;
$(
'#seconds'
).html(minutes +
':'
+ seconds);
}, 1000);
setTimeout(
function
() {
//Show Popup before 900 seconds of timeout.//
$(
'#dialog'
).dialog(
'open'
);
}, timeout - 900 * 1000);
setTimeout(
function
() {
window.location.href =
"../../../User/SessionExpired"
;
}, timeout);
};
function
ResetSession() {
//Redirect to refresh Session.
window.location = window.location.href;
};
function
CloseSession() {
//Redirect to refresh Session.//
window.location.href =
"../../../User/SessionExpired"
;
};
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"
);
var timeout = section.Timeout.TotalMinutes * 1000 * 60;
ClientScript.RegisterStartupScript(
this
.GetType(),
"SessionAlert"
,
"SessionExpireAlert("
+ timeout +
");"
,
true
);
}
<sessionstate mode=
"InProc"
timeout=
"120"
>
Reply
Answers (
3
)
Pass complex object on Post Redirection without TempData in .Net Core.
Id value undefined