Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session value expires too quickly in hosting environment.How to fix this in asp.nen

Tags:

asp.net

Session value expires too quickly in hosting environment.How to fix this in asp.net

like image 414
user1235054 Avatar asked Nov 27 '22 16:11

user1235054


1 Answers

You can't do anything about session lifetime, as even if you change that property in the web.config the hosting machine configuration file will always prevail on that, and if they have 5 minutes, no matter if you have 60 minutes in your web.config the session live span will always be 5 minutes.

What you can do is change to SQL Session State and it's only there where you have total control on your session live span, but there are advantages and disadvantages on using this.

Or you can avoid the session all together by using the Cache System.

Unfortunaly this happens to much on Shared hosting, and keep in mind that the session will reset every time your application pool refreshes and this happens much more frequently in shared hosting.

like image 117
balexandre Avatar answered Dec 05 '22 00:12

balexandre