Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
What to do when session is getting expired frequently
I have one application built in ASP.NET.
On login page I have taken user id and stored it in one Session Variable Session["user_id"].
I am using it throught the application as we want to know that which user has added that particular record.
We are storing added by field in every table of database.
Many users get logged in in the system at a particular time.
Sometimes the session gets expired automatically and we does not get the Session["user_id"].
It gives the following error and comes to the login page as we have redirected to login page when session expires.
System.NullReferenceException: Object reference not set to an instance of an object.
We have given Session TimeOut 120 minutes in web.config but session is getting expired frequently.
Can any one tell what can I do so that Session does not get expire before 120 minutes.
Help is greatly appreciated.
Thanks and Regards,