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
Hari B
NA
139
68.3k
How to focus after session time out.If user in other browser
Feb 12 2016 1:21 AM
Please find below of my code
Ispostback:
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;
Page.ClientScript. RegisterStartupScript(this.GetType(), "onLoad", "DisplaySessionTimeout(" + timeout + ")", true);
}
Jquery:
<
script
type
=
"text/javascript"
>
var
sessionTimeout = "<%=
Session.Timeout
%>";
function
DisplaySessionTimeout(timeout) {
var seconds = timeout / 1000;
document.getElementsByName("
seconds
").innerHTML = seconds;
setInterval(
function
() {
seconds--;
document.getElementById("
seconds
").innerHTML = seconds;
}, 1000);
setTimeout(
function
() {
//Show Popup before 20 seconds of timeout.
$("#
ExpireConfirm_Submit
").dialog({
height: 200,
width: 400,
resizable:
false
,
modal:
true
,
title: "
Session Expire Confirmation
",
open:
function
() {
$('
p#id1
').html(sessionTimeout);
},
buttons: {
"
Yes
":
function
() {
$(location).attr("href", "/Account/Logout").submit();
$(
this
).dialog("close");
},
"
No
":
function
() {
ResetSession();
$(this).dialog("close");
}
}
}).prev(".
ui-dialog-titlebar
").css("
background
", "
red
");
}, timeout - 20* 1000);
setTimeout(
function
() {
$(location).attr("
href
", "
/Account/Logout
").submit();
}, timeout);
};
function
ResetSession() {
window.location = window.location.href;
}
</
script
>
if user in other tab. how can we set focus to dialog box.
Reply
Answers (
0
)
How to check form is valid or not on button click in mvc vie
How to call post method on hyperlink click in knockout js