Session Timeout

Session Timeout

am 28.01.2008 17:53:00 von JohnWalker

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

Re: Session Timeout

am 28.01.2008 19:39:45 von DFS

Page.Session.IsNewSession will be true if new session.

-- bruce (sqlwork.com)



John Walker wrote:
> 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

RE: Session Timeout

am 28.01.2008 20:35:01 von 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");
}
}


"John Walker" wrote:

> 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

RE: Session Timeout

am 28.01.2008 21:24:12 von JohnWalker

Thanks for this. It looks like it is exactly what i need.

"Wannabe" wrote:

> 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" wrote:
>
> > 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