Please check the code below:
public class SessionDemo : System.Web.UI.Page
{
public SessionDemo()
{
}
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
if (Context.Session != null)
{
if (Session.IsNewSession)
{
string szCookieHeader = Request.Headers["MyCookie"];
if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionID") >= 0))
{
Response.Redirect("TimeoutPage.htm");
}
}
}
}
}