Session timeout checking in ASP.NET

Naimishforu
Posted by Naimishforu under ASP.NET category on | Points: 40 | Views : 3321
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");
}
}
}
}
}

Comments or Responses

Login to post response