Last post Nov 30, 2015 01:26 PM by PatriceSc
Nov 26, 2015 07:39 PM|JamesWang|LINK
I set session timeout to 1 minute. But after a couple of minutes with no action, the code can still get the user ID stored in session variable when a button is clicked on the web from.
Any idea why?
Nov 26, 2015 08:11 PM|PatriceSc|LINK
How do you initialize that? You could just have some logic that restore again the same value when the next session starts.
I would show SessionID and the session start full date time (initialized iin the Session_Start event). It should allow to make 100% sure if this is the same session or not by showing at least a value that is expected to change.
Nov 27, 2015 06:50 AM|Chris Zhao|LINK
You could check if session = null and do a Response.Redirect("Home.aspx");
if(Session["UserId"] == null)
Nov 30, 2015 01:11 PM|JamesWang|LINK
That's exactly what I did.
After a couple of minutes, Session["UserId"] is still not null, even though in Web.config the session timeout is set to 1 minute.
Nov 30, 2015 01:26 PM|PatriceSc|LINK
But when do you initialize this session variable? Could it be that you initialized this session variable for another session?
This is why I suggested earlier to show the SessionID and the start date/time for the session. it would allow to make 100% sure if this is the same session or if this is another session.