Date:  11/27/2002 06:13:29 PM Msg ID:  001029
From:  FoxWeb Support Thread:  001027
Subject:  Re: script_name problem
If the URL is to be embedded in the output of the script, then you only need to use a relative URL, by including the script name, as described in the Locating and Addressing Scripts topic of the FoxWeb documentation.  If on the other hand you need to use a full URL, you can use the following code:
 
DO CASE
CASE Request.ServerVariables("HTTPS") = ""
* Server does not support HTTPS server variable
IF Request.ServerVariables("SERVER_PORT") = "443"
UrlString = "https://"
ELSE
UrlString = "http://"
ENDIF
CASE LOWER(Request.ServerVariables("HTTPS")) = "on"
UrlString = "https://"
OTHERWISE
UrlString = "http://"
ENDCASE
UrlString = UrlString + Request.ServerVariables("SERVER_NAME") + ;
Request.ServerVariables("SCRIPT_NAME")
IF Request.ServerVariables("PATH_INFO") <> Request.ServerVariables("SCRIPT_NAME")
* For script mapped URLs SCRIPT_NAME is usually the same as PATH_INFO
UrlString = UrlString + Request.ServerVariables("PATH_INFO")
ENDIF
IF NOT EMPTY(Request.ServerVariables("QUERY_STRING"))
UrlString = UrlString + "?" + Request.ServerVariables("QUERY_STRING")
ENDIF
 
This code has been tested with IIS.  If it does not work with Apache, then you may want to try using just the PATH_INFO variable.

FoxWeb Support Team
support@foxweb.com email

Sent by Alan Harris-Reid on 11/26/2002 07:01:53 PM:
I am trying to include a self-referencing URL within a .fwx script using Request.ServerVariables('script_name').  Under IIS this works fine and the function returns 'MyScript.fwx', but when I run the same script under Apache it returns 'cgi-bin/foxweb.exe', which is no good to me at all!
 
Any ideas how to solve this problem would be appreciated.
 
Alan Harris-Reid