i search google and found many answers for detecting session expiry programmatically. this is code which i saw everyone use it
global.asax
---------------
protected void Session_Start(object src, EventArgs e)
{
if (Context.Session != null && Context.Session.IsNewSession)
{
string sCookieHeader = Request.Headers["Cookie"];
if (null != sCookieHeader && sCookieHeader.IndexOf("ASP.NET_SessionId") >= 0)
Response.Redirect("/Session/Timeout");
}
}
i have few question on the above code
1) when session expire then how Context.Session will not be null?
2) what is the meaning of this line Request.Headers["Cookie"];
looking for good discussion. thanks