I am making an application to edit mp3 files. After the editing is finished I want to present a link to download the file. I am just concerned that the file location, if known, can be abused for illegal files. What do I need to do so that, instead of presenting a link to a file on the server, I can store it in memory (which I already have using taglib) and then stream the download without storing it on the server.
Share
You need to use an HTTP Handler to write the file to the user while masking the true location of the file on the server. This will enable you to enforce whatever rules you may have regarding the downloading of the file, such as a one time download.
See: How to create an HTTP Handler
The code inside the handler will need to be unique to your needs, but something along the following lines should help:
You could use a Stream in case you don’t want to save an actual file anywhere, but this should get you started.