Asp.net set session timeout:
Write below code in .CS file
string str_jscript = "TimeOutExpire(" + Convert.ToString(Session.Timeout * (60 * 1000)) + ");";
Page page = System.Web.HttpContext.Current.Handler as Page;
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(), "", str_jscript, true);
Write Below code in .ASPX page
<script type="text/javascript">
var timer;
function TimeOutExpire(obj) {
window.clearTimeout(timer);
timer = window.setTimeout(function () { window.location = "Loginpage.aspx?PID=EAN" }, parseInt(obj));
}
</script>
No comments:
Post a Comment