[英]Session Timeout Warning dialogs mvc
I am looking to add Session Timeout Warning dialog 15 minutes before session expires.The popup indicates session is going to be expired so that user can continue/extend the session or he may logout also 我想在会话到期前15分钟添加会话超时警告对话框。弹出窗口指示会话即将到期,以便用户可以继续/扩展会话,或者他也可以注销
How can i achieve this. 我怎样才能做到这一点。
I tried researching on how to do this but I have not find anything that will help me. 我尝试研究如何执行此操作,但没有找到任何对我有帮助的内容。
I realized i need something like this but I am not sure how a filter will help 我意识到我需要这样的东西,但是我不确定过滤器将如何帮助您
Redirect to specific page after session expires (MVC4) 会话过期后重定向到特定页面(MVC4)
also I looked at http://www.codeproject.com/Articles/227382/Alert-Session-Time-out-in-ASP-Net but i did not make sense to me. 我也看了http://www.codeproject.com/Articles/227382/Alert-Session-Time-out-in-ASP-Net,但对我来说却没有意义。
I looked at timeout-dialog.js how can i used this in mvc 我看着timeout-dialog.js如何在mvc中使用它
help will be apreciated 帮助将不胜感激
You should try this 你应该试试这个
@{
var conf = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
var section = (System.Web.Configuration.SessionStateSection)conf.GetSection("system.web/sessionState");
string timeout = section.Timeout.TotalMinutes.ToString();
}
<script>
$(document).ready(function () {
var time = @timeout * 1000 * 60;
var timeout;
var isLogout = false;
timeout = setTimeout(function() {
//Things you need to do
isLogout = true;
}, time);
$(document).on('click', function () {
if (!isLogout) {
clearTimeout(timeout);
timeout = setTimeout(function() {
//Things you need to do
isLogout = true;
}, time);
}
});
});
</script>
How to know when OWIN cookie will expire? 如何知道OWIN Cookie何时到期?
Looks like what you are talking about? 看起来像您在说什么? Let me know if it isn't.
让我知道是否不是。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.