Hi Jimmy,
We received your application and I took a quick look.
First, two "words of wisdom" :-) By using Visual WebGui authentication mode you are actually requesting that if there is a request made from the client to the server, and the session does not have IsLoggedOn = True, then redirect that request to the Logon form you specify.
That means that you should not have a redirect in your Logon form processing, as the next request made from the client to the server after you set IsLoggedOn = True, it will pass the logon form and go directly to the requested destination form, MainForm.wgx in this case.
Second, you need to remember that you are attaching to an application level event when you attach to ThreadExit and in your case this fact, your extra redirect in the logon form and an unfortunate sequence of events
makes your app behave like it does.
If you debug it and watch carefully what happens, you will see the Load event of your MainForm fire twice. My guess is that the first fires as this was the first request to the server after you set the IsLoggedOn = True and the second fires immediately after caused by your extra redirect.
The effect in your scenario is that when the second ThreadExit fires, you alrready attached your event handler to the ThreadExit event, and therefore you exit your application right away.
Just by commenting out the redirect from your Logon form processing (the LogonWebUser sub), you should be running quite fine.
Finally, are you sure you want to attach to the ThreadSuspend event like that ? Please take a look when the ThreadSuspend event fires on this wiki page here.
Hope this helps to get you on track again.
Palli