IIS app pool recycle and session invalid


I have have an application that am playing with that is pretty much a dashboard that will be displayed on a big monitor in a lunch room wall type of situation.  It uses a timer to refresh charts.

Every night when IIS recycles, it kicks me out with an invalid session. I understand why it is doing this because the application pool is shutdown and sessions are lost.

Is there any way for me to set something up so that my application could know that the session went invalid and after 10,20 seconds tried to connect again?

I would think this would have to be client side/javascript but I don’t know.


As additional info…

I was thinking I could save what form was showing into a cookie and then when the app came back up, the program.vb would look in the cookie to see what dashboard form to display.




  • You must to post comments

I don’t know if this is applicable but as a workaround you could tell it to never recycle or increase it to something like a week. The only reason why it really recycles I believe is to solve memory or handle leaks that a software developer might have created. There is actually no need unless you are seeing issues with it running for so long.

  • Shawn Ramirez
    Thank you, that would help, but that would still require someone to go out to that “station” and ‘fix” it every Monday. I don’t know if that would be ok or not. But your suggestion does get be closer. Thanks
  • Mark Reed
    You could try having a c# timer run once a day and calls this.Eval(“location.refresh()”); Eval allows you to execute javascript
  • You must to post comments

If you add the script below to Default.html you can handle any exception on the client side. The InvalidSession exception has the message = “Invalid Session” and a flag invalidSession = true. The message text can be localized, so it’s better to check the flag.


Wisej.onException = function(ex)
if (ex.invalidSession)


As soon as wisej (client) detects an invalid session it will reload the page.


  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.