Session Timeout

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
 
W

Wannabe

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");
}
}
 
J

John Walker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top