I have this setting in the web.config file: <sessionState timeout="540" />. This tries to make all the sessions expires after 8 hours. However, the session expires much faster than that and I got an object reference not set to an instance of an object error. Could some tell me if there is something else affects the session?
Thanks in advance!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
SessionState expires also if the application pool recycles (inactivity, exception, or configuration).
Anyway, it is not a best practice to extend the SessionState timeout so much.
maybe you should change you dependency to session or use a different way to persist those objects (viewstate).
If you absolutely need to have session to persist so much you should use another server or a db as session store.
http://msdn.microsoft.com/en-us/library/ms178586(v=vs.100).aspx
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0