Random Connect Errors

I am using Flash 2004 MX to invoke ColdFusion MX 7 which is interrogating a MySql DataBase.

Basically in a flash movie, a form is constructed dynamically in stages. After the first stage, I interrogate the database to prevent a duplicate entry, then I allow the user to proceed with the rest of the form. Once the user finishes the form, I do another duplicate check (on a different table) and if that passes I do a record insert.

The problem I am having sometimes – not all the time, occurs between the 1st query and the 2nd (both checking for duplicates and returning a record count). When connected to CF7 locally (on my personal network), it will always work.

However, when the client (the flash movie/form) is not directly on the same network, I sometimes (intermittently) get a connection error – ONLY on the 2nd query.

Using the NetConnect Debugger, I have found that inexplicably, on some occasions, the second CF query is invoked with a ‘jsessionid’, which if present, always causes the connection to fail (apparently do to a 404 error).

The first query never has a ‘jsessionid’ and will always work, but sometimes, under circumstances I can not fathom or duplicate, it will randomly add this to the ConnectString and cause this error. Here is the ConnectString that is causing my error:

ConnectString: http://xxx.xxx.xxx.xxx/flashservices/gateway;jsessionid=b8305942b707IX$26$29

Can anyone help me understand why it adds this some times but not all the time? Additionally, how might I prevent the ‘jsessionid’ from causing a connect error (if possible)?

If no one can answer those things, is there someone with a quick fix?