Just make sure any files you write out are in the virtual directory folder hierarchy of your Web application to ensure that the transmit file will work.
If that doesn't work then you have to explicitly stream the file through code using Response.Write() (either using FILETOSTR() or a low level FREAD() loop).
Hi,
I have two WC 5 apps running on Windows 7. I am running them both inside of VFP, with pass-through authentication. The Windows user is an administrator. Both apps are running under the same IIS Web site. They are two different virtual directories, each with its own script map.
In one of them, I used RESPONSE.DownloadFile to download a file that is not accessible through the public Web site. It works fine. I copied the Web page and the .prg to the second app. The only thing that I changed is the extension of the Web page to match the script map. I am attempting the download the exact same file, from the same directory, running under the same user. It works fine in the first app. The second app gives me the following error:
Unable to download file
We were unable to send the requested file to the client.
'd:\pdfs\20130422\1\test2.pdf' is not a valid virtual path.
--------------------------------------------------------------------------------
Message generated by Web Connection IIS Connector Module
Here is the code that is in my Web page. THIS.oEntry is an instance variable for a wwBusiness object, which is instantiated in a parent wwWebPage class. Again, this same code works in the other app and the file is not accessible from the public Web site for either app.
FUNCTION OnLoad()
DODEFAULT()
IF NOT EMPTY(THIS.cID) THEN
THIS.DowloadRequestFile()
ENDIF
ENDFUNC
FUNCTION DowloadRequestFile()
sSQL = "SELECT * FROM roi.tbl_REQUEST_FILES WHERE FK_REQUEST = "
sSQL = sSQL + SESSION.GetSessionVar(THIS.cSessionVarRequestID)
sSQL = sSQL + " AND ID = " + THIS.cID
IF THIS.oEntry.Query(sSQL, "TDownload") = 1 THEN
RESPONSE.DownloadFile(TDownload.FilePath + TDownload.Filename)
ENDIF
ENDFUNC