The Server.Transfer method is an enhanced form of VFP's DO command. It does not force a round trip to the browser, so the SCRIP_NAME server variable stays the same. You should use the PROGRAM(), or SYS(16) functions.
Sent by Gabriel Badea on 12/22/2007 09:14:53 AM:
After re-reading my question, I must look like a real twit... Obviously I know which script I'm executing, since I called it...
The question re-phrased :
My pages include the following code :
<% Response.Write(GetContextualHelp(Request.ServerVariables("SCRIPT_NAME"))) %>
Now, the problem becomes more apparent : Since Request.ServerVariables("SCRIPT_NAME") returns the called script name even after a Server.Transfer(<new_script>), once I have rendered the page, the help content is for the original script that was called by the browser and not the new script I transfered to.
By the way, I understand that request.servervariables("SCRIPT_NAME") will always return the called script even after a Server.Transfer() since the "request" was for that script.
Is there a way to get the executing script name and not the one requested by the browser ?
Should I use PROGRAM() to determine what I'm executing?
Hope my question is a little more clear now.
Sent by Gabriel Badea on 12/22/2007 08:49:01 AM:
I use Sever.Transfer() to execute another fwx script.
I also rely on Request.ServerVariables("SCRIPT_NAME") to render contextual help.
However once I have issued Server.Transfer(<new_script>), Request.ServerVariables("SCRIPT_NAME") still returns the original script that was called by the client. Therefore I get the help content for the original script that I called, which in this case is the wrong help content.
My question is : How do I know what script I am executing or should I keep track of these transfers myself and code accordingly ?