Session Timeout

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
JohnWalker [ Mo, 28 Januar 2008 17:53 ] [ ID #1917912 ]

Re: Session Timeout

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
DFS [ Mo, 28 Januar 2008 19:39 ] [ ID #1917928 ]

RE: Session Timeout

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
Wannabe [ Mo, 28 Januar 2008 20:35 ] [ ID #1917934 ]

RE: Session Timeout

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
JohnWalker [ Mo, 28 Januar 2008 21:24 ] [ ID #1917941 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Session Timeout

Vorheriges Thema: aspx reporting component
Nächstes Thema: VS 2005 Web Site Project vs Web Application Project