Session Timeout

Discussion in 'ASP .Net' started by John Walker, Jan 28, 2008.

  1. John Walker

    John Walker Guest

    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
    John Walker, Jan 28, 2008
    #1
    1. Advertising

  2. John Walker

    bruce barker Guest

    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
    bruce barker, Jan 28, 2008
    #2
    1. Advertising

  3. John Walker

    Wannabe Guest

    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, Jan 28, 2008
    #3
  4. John Walker

    John Walker Guest

    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
    John Walker, Jan 28, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    6,362
  2. bruce barker

    Re: ASPX Page Timeout - Session Timeout

    bruce barker, Jul 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    11,109
    ASP.Confused
    Jul 20, 2004
  3. =?Utf-8?B?Q3JhaWc=?=

    formsauthentication timeout & session timeout

    =?Utf-8?B?Q3JhaWc=?=, Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,642
    =?Utf-8?B?RU5JWklO?= .enizin.net>
    Aug 10, 2005
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,267
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,279
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page