0
我想在我的ASP .net Web應用程序上實現超時功能。這樣用戶將在60分鐘後重定向到超時消息。 我曾經在webconfig帶顯示超時錯誤消息的ASP .NET超時實現
<sessionState timeout="60"></sessionState>
下面我找不到任何usfull例如在線完成這個任務。 我不知道是否有任何使用jQuery或Javascript在客戶端執行此操作?
我想在我的ASP .net Web應用程序上實現超時功能。這樣用戶將在60分鐘後重定向到超時消息。 我曾經在webconfig帶顯示超時錯誤消息的ASP .NET超時實現
<sessionState timeout="60"></sessionState>
下面我找不到任何usfull例如在線完成這個任務。 我不知道是否有任何使用jQuery或Javascript在客戶端執行此操作?
通過實現一個在clinet端執行的jQuery函數並重定向用戶超時頁面來解決這個問題。
$(document).ready(function() {
var timeInSeconds = 30
var timeoutTimer = timeInSeconds * 1000;
var timeoutToRefresh = window.setTimeout(timeoutfunction, timeoutTimer)
var isPostBack = ("true" === "<%= Page.IsPostBack ? "true" : "false" %>");
if (!isPostBack) {
$('#cost').hide();
$('#imgCost').attr("src", "../../Design/Images/iconPlus.png");
} else {
$('#imgCost').attr("src", "../../Design/Images/minus_icon.png");
}
});
var timeoutfunction = function() {
window.location.replace('/CustomErrorPage.aspx')
};
你有沒有試過計時器課? https://msdn.microsoft.com/en-us/library/system.timers.timer(v=vs.110).aspx –
不,我需要在ASP中做.Net – Mindan
什麼樣的ASP.NET - ASP.NET核心,ASP.NET MVC或ASP.NET Web窗體? – Win