I would like to display the "Your session has expired" on logon page if session has been idle for given 5 minutes.
What should the time out value be for Sql Session State and Form Authentication Time Out:
- same?
- session state> form timeout
- Form time out > session time.
ideally, if someone could explain the diff between above will be appreciated.
Currently, my code looks like below and Session["SessionID"] is not Null even after Login redirection for idle of 5 minute:
On Session_Start()
Session["SessionID"] = Guid.NewGuid();
On LogOn.cshtml:
@{
string sessionExpiredMsg = string.Empty;
HttpContext ctx = HttpContext.Current;
if (ctx.Session["SessionID"] == null)
{
sessionExpiredMsg = "Your session has expired. Please re-login again.";
}
}
@
On web.config:
<sessionState
timeout=5....
<authentication mode="forms"
timeout=5....
Thank you.