Timers/Threads in Web apps

The problem is that Threads and regular Timers fire on the main thread, with no session information associated with them and the underlying web framework relies on knowing what the current session is to figure out what your code means when you say WebPage1.Show.

The solution to this is for you to create an instance of WebSessionContext in the Action event which points to the session that you want it to affect. WebSessionContexts are hints to the web framework as to which session they should be interacting with.

Your best bet will probably be to create a timer subclass which has a WeakRef to the session to which it belongs and then do something like this in the Action event:

If mySession<>nil and mySession.value<>nil then Dim wsc as new WebSessionContext(WebSession(mySession)) // Run your code here Else The session no longer exists... don't do anything. End If