One issue related to this is I have a page which must be secure with a similar issue.
It is a registration update page. If I try to run it as a secure page the UserID seems to be old and not the one for the person just logged in.
If I make the page unsecure it works correctly.
I tried moving the code down which makes the page secure but it got the problem back.
Is there a way to avoid this issue and still make the page secure?
I have attached the page. (this is the version which works correctly, that is the unsecured version.)