lifetime of Session and Application ???


C

Chris

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
 
Ad

Advertisements

N

Nick Gilbert

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.
 

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

Top