Home > how to > how to handle session timeout error in asp.net

How To Handle Session Timeout Error In Asp.net

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What is the best approach to handle session timeouts in asp.net up vote 4 down vote favorite 2 There are various ways to handle session timeouts, like "meta refreshes" javascript on load functions etc. I would like something neat like: 5 minutes before timeout, warn the user... I am also contemplating keeping the session open for as long as the browser is open(still need to figure out how to do it though... probably some iframe with refreshing). How do you handle session timeouts, and what direction do you think i should go in? c# asp.net session-timeout share|improve this question asked Jul 22 '10 at 12:42 Dusty Roberts 2,01134068 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote accepted The best approach to handle sessions timeouts. I say that there is 2 basic cases. One is when the users enter little or no data, and just read reports, or do small thinks with his mouse. In this case there is not easy way to inform him that the session is going to expire. If you going to check the time left for the session calling the code behind, then automatically you update the session. Then if you have a timer to count down the session, then maybe the user have open a new tab of your web and the session is going to expired but not the time you have note with javascript and the user receive wrong message. So for me, when the user enter little or no data, just let the session expired, if he lose one click, it will do it again later. Second is when the user need to enter many data, that some time can take time, a long text for example, to write it and fix it. In this case I use the below technique and I am not let the session go out. How to keep the session open as long as the browser. Here is a very nice and simple technique, I use an image that I make an reload of it before the session is timeout using JavaScript.

 

© Copyright 2019|winbytes.org.