0

I am developing a asp.net web application. I am making use of Session variable to store user id and user name. Session variables tend to expire after some time, which we can configure in web.config. To avoid session variable from getting expired is it good if we re assign the session variable to itself every 5-10 minutes!?

in the client side if we have a settimeout or setinterval and make a ajax call to assign the session variable to itself every five minutes, will this prevent session expiring!?

I want to do this to make sure that no error arises because of session expiring.

Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150

1 Answers1

0

You basically have two options to extend default session expiry time or to do what you’re suggesting with reassigning values.

Why don’t you just extend default session expiry time? It will use more memory on the server but unless you have a ton of users and a lot of data stored in session objects (in which case you should consider getting better server for you app) you should be fine.

Another thing I’d use is some kind of analytics software to tell me how much time on average your users are spending with the app. This will give you good info on what do to.

Ron Biggs
  • 353
  • 3
  • 6