0

I have an asp.net website running on IIS server 8.

My Session variables are set to null after a minute of idle time (consistently), following which I get unhandled exceptions. However, if I keep navigating and doing something everything works fine.

In my web.config file the sessionstate mode is SQLServer and timeout is 20 (mins). I think even by default the timeout is 20 minutes, so for this to happen within a minute really baffles me.

I don't understand what other thing could make the session variables lose their values? Any pointers? Thanks

devSuper
  • 295
  • 1
  • 4
  • 18
  • Have you checked the actual application in IIS or the Application Pool that the application is in? An application restart will loose the session - this can be caused by changing web.config or the application pool recycling. – James Culshaw Mar 18 '13 at 17:20
  • Never used SQL Server session state but I'd say the first step is trying to confirm in some way that is working as expected – Claudio Redi Mar 18 '13 at 17:21
  • I did check the Event Log and I am positive there is no application restart when this happens. Why not use SQL server session state? – devSuper Mar 18 '13 at 17:26
  • Do you only have 1 webserver? – granadaCoder Mar 18 '13 at 17:36
  • If you have more than 1 webserver (load balancing for example) : check this post: http://stackoverflow.com/questions/10555000/losing-session-state-with-asp-net-sql-server – granadaCoder Mar 18 '13 at 17:42

1 Answers1

0

I would suggest running a packet sniffer such as WireShark or using the Fiddler tool to ensure you are getting the same, consistent session ID cookie when this occurs. This could explain the issue if for some reason you are getting different sessions. Otherwise, check you code using the debugger to ensure you are not incorrectly clearing or setting the session values to null.

  • I don't think this is happening in code as on my local system (via the .net development server) it all works flawlessly. I will try Fiddler. Thanks. – devSuper Mar 18 '13 at 17:31