Session Variables

  • Thread starter Thread starter brian
  • Start date Start date
B

brian

I have my session timeout at 20 minutes. Is there a way
to set session time per variable. For instance: I
create session("TEST") and I want it to expire in 2
minutes of no activity...Is that possible?

For Clarification:
If session time out in the web.config file is set to 20
minutes the session only times out if no activity occurs,
right!


Thanks
 
Nope. Just clear this variable when it is no more needed ? Use a timestamp ?

What is scenario ?
 
I think you can consider the use of Cache class
Page.Cache.Insert("KEY", value, null, DateTime.Now.AddMinutes(2),
TimeSpan.Zero);
will insert a value that will expire in 2 minutes without sliding
expiration.
See System.Web.Caching.Cache class for more information about this.

I hope this helps
I have my session timeout at 20 minutes. Is there a way
to set session time per variable. For instance: I
create session("TEST") and I want it to expire in 2
minutes of no activity...Is that possible?

For Clarification:
If session time out in the web.config file is set to 20
minutes the session only times out if no activity occurs,
right!
Yes. If something happen the timeout is slided with another 20 minutes.
 
Back
Top