Just for any future reference to this.
You absolutely can rename files in Webhandler, and if you're building a system that allows people to download files from links (ie, here's a link instead of an attachment), then it's a great thing to understand.
_SendFile, before the Parent Call, is where you can do it.
The thinking is, simply, if I rename a file then it's something I want the person to download (because in here all kinds of things are dealt with).
My code is:
!** SEND the actual file **
if (found# = 1)
Debug('('&sa:ProcedureName&', Rewrite) Sending file: '&clip(str4.GetValue()))
str5.SetValue(str4.FileNameOnly())
str5.Replace('$$$','')
Debug('('&sa:ProcedureName&', Rewrite) Filename: '&str5.GetValue())
PARENT.ForceNoCache = 1
PARENT.HeaderDetails.ContentDisposition = 'attachment;filename="'&str5.GetValue()&'"'
PARENT._SendFile(str4.GetValue(),p_header)
str4.Free()
else
* found# is saying "yes, the file is here"
* str4 has the filename that I used to create the pdf report
* str5 gets the filename, removes the $$$ (which is used to tell the webserver it's a temp report)
* We use our own call to _SendFile and content stuff etc, to make sure the file is downloaded the way we want
(attachment shows the else / end code that wraps the parent call)
Hope that helps someone in the future.