I've been working for a while in trying to troubleshoot a situation and here's what I have concluded:
I have several datasessions opened in my Web framework. Just before calling Response.ExpandTemplate(), SET('DATASESSION') returns 2. However, if the template being expanded contains SET('DATASESSION'), it always returns 1. I added a hook in it to print the datasession and, for some kind of reason, it resets to the default datasession when expanding a template. This is causing us a major problem. Anyone has a workaround for that?