Hi Wolfgang,
Okay, so, here's the gist of what my code does (although Bruce's book/code would surely be simpler and more profound, ha).
1. Code goes into the _SendFile embed. I was (and still do for a couple of little things) using the _TranslateFileName embed to redirect a file and rewrite the url, but there are length issues with what is passed to and fro. Anyway, _SendFile!
2. You want to get a couple of StringTheory vars going on, very very helpful for doing file stuff.
3. You need to get to the point of knowing the url is something you want to allow for a custom download (ie my code splits the url into segments based on the \)
Something like this: Url: <purpose>\<context>\<guid1> or <subcontext>\<guid2> or <guid1>
4. Once you get there, you start setting the file information for the webserver.
For example, here's the psuedo code for one type of download file option I use. The str_DownloadFile StringTheory var has the absolute path of the file you want to download.
self.ForceNoCache = 1
str_Filename.SetValue(str_DownloadFile.FileNameOnly())
self.ReplyContentType = 'application/'&str_DownloadFile.ExtensionOnly()
p_Header = NET:SendHeader + NET:DontCache
self.ForceNoCache = 1
self.HeaderDetails.ContentDisposition = 'attachment;filename="'&str_Filename.GetValue()&'"'
5. Now, this is important. You don't want the default webserver functionality to happen. So at the bottom of the _SendFile embed BEFORE the parent call you need an if statement that starts, and it finishes in the AFTER parent call embed.
The code at the bottom of your _SendFile embed would look something like:
if (customdownloadflag = 1)
self._SendFile(str_DownloadFile.GetValue(),p_Header)
Then at the start (really it's the only thing) of the embed AFTER the parent call, you end your if statement:
end