Session Timeout

  • Thread starter Thread starter John Walker
  • Start date Start date
J

John Walker

In asp.net 2.0 is there a way on postback to determine if a session has timed
out and then redirect to another page which gives the user some sort of
"session timeout" message?

Thanks,
John
 
I have this method in a base page that is inherited from and it works very
well for our application.

public void CheckSession()
{
//Make sure the session is still valid first. If not, redirect back to
the login page.
if (Context.Session != null)
{
if (Session.IsNewSession)
Server.Transfer("~/SessionExpired.aspx");
else if (Session["PersonnelID"] == null)
Server.Transfer("~/index.aspx");
}
else
{
Server.Transfer("~/index.aspx");
}
}
 
Thanks for this. It looks like it is exactly what i need.

Wannabe said:
I have this method in a base page that is inherited from and it works very
well for our application.

public void CheckSession()
{
//Make sure the session is still valid first. If not, redirect back to
the login page.
if (Context.Session != null)
{
if (Session.IsNewSession)
Server.Transfer("~/SessionExpired.aspx");
else if (Session["PersonnelID"] == null)
Server.Transfer("~/index.aspx");
}
else
{
Server.Transfer("~/index.aspx");
}
}


John Walker said:
In asp.net 2.0 is there a way on postback to determine if a session has timed
out and then redirect to another page which gives the user some sort of
"session timeout" message?

Thanks,
John
 
Back
Top