>> 1. The session id changes as I work through the pages - I have always thought that once the session started that the id remained the same so I'd like a comment on that.
A session ID can change during a login if the p_web.site.ChangeSessionOnLogInOut property is set. This is set via a template option in the web server procedure, Security tab, "Change Session on Login".
However this change preserves all the session values etc - so it should be a seamless change for you. (the exception would be where you are using the SessionId in your own mem tables etc at which point the user will be disconnected from these rows.)
>> So, it looks as if the problem is that the thread has changed and that has caused the session variables to be reset. I don't understand why.
Every incoming request takes place on it's own thread. If you have multiple requests happening at the same time then you'll see thread 4 and 5 and so on come into play.
If you never see thread 3 again then that's a sign that that thread never ended. Usually a sign of a bug in your code causing the thread to get into an endless loop, or wait infinity for some SQL request, or perhaps choke on a corrupt TPS file or whatever. Debug by inspecting the last request handled by that thread, and follow the logic of that thread to see if it ends.
Each incoming request contains the SessionID as a cookie. The most likely cause of a NewSession being generated is if this cookie is lost, or indeed if the request is coming from another browser (ie another user.) Because your exe can serve multiple users at the same time, it's necessary to bear that in mind when viewing the logs. If your thread numbers are > 3 then that's another sign you have multiple simultaneous users in play.
Of course a session can also time-out on the server side. the time it lives for (since the last request) is set in the WebServer, Advanced tab. In this case the request will come though with a session ID, but the server side will have no recollection of that session, so all the session values will be blank.
Cheers
Bruce