lifetime of Session and Application ???

Discussion in 'ASP .Net' started by Chris, Jun 3, 2010.

  1. Chris

    Chris Guest

    Hello.

    Lifetime of Session-data is specified in web.config.

    But what about Application-data?

    I have a little testWebApp in which Session-timeout is set to 1 minute

    Application["AppData"] = 1;
    Session["SessionData"] = 2;

    lblAppData.Text = Application["AppData"] != null ?
    Application["AppData"]: "Expired"
    lblSessionData.Text = Session["SessionData"] != null ?
    Session["SessionData"]: "Expired"

    refreshing the page after more than 1 minute displays "Expired" for
    Session but keeps on showing the Application-data.

    So, what determines the lifetime of Application-data?

    thx
    Chris
    Chris, Jun 3, 2010
    #1
    1. Advertising

  2. Chris

    Nick Gilbert Guest

    On 03/06/2010 16:53, Chris wrote:
    > Hello.
    >
    > Lifetime of Session-data is specified in web.config.
    >
    > But what about Application-data?
    >
    > I have a little testWebApp in which Session-timeout is set to 1 minute
    >
    > Application["AppData"] = 1;
    > Session["SessionData"] = 2;
    >
    > lblAppData.Text = Application["AppData"] != null ?
    > Application["AppData"]: "Expired"
    > lblSessionData.Text = Session["SessionData"] != null ?
    > Session["SessionData"]: "Expired"
    >
    > refreshing the page after more than 1 minute displays "Expired" for
    > Session but keeps on showing the Application-data.
    >
    > So, what determines the lifetime of Application-data?


    Application data only expires if IIS is restarted, or the application
    pool it's hosted in is recycled. This can happen if the website is not
    accessed for a long time, or if a worker process crashes or is recycled
    by IIS due to it using too much RAM. Application variables should not be
    treated as a permanent data store and your application should be able to
    cope with the Application variables disappearing at any time.

    Nick.
    Nick Gilbert, Jun 4, 2010
    #2
    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. Bruce W.1
    Replies:
    1
    Views:
    320
    Alvin Bruney [MVP]
    Jan 29, 2004
  2. Colin Basterfield

    lifetime of Session object

    Colin Basterfield, Jun 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    437
    Colin Basterfield
    Jun 3, 2004
  3. Replies:
    0
    Views:
    417
  4. Sashko
    Replies:
    1
    Views:
    737
    Joerg Jooss
    Jun 22, 2006
  5. Paolo Pagano

    Application object lifetime

    Paolo Pagano, Jul 22, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    120
    Paolo Pagano
    Jul 22, 2003
Loading...

Share This Page