Welcome to WebmasterWorld Guest from 18.206.194.83

Forum Moderators: ocean10000

Message Too Old, No Replies

Hide filename during download with .NET

     
2:21 pm on May 22, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 12, 2002
posts: 1482
votes: 0


I have a handler with the URL of GetMyFile.ashx?key=abc123

The file that corresponds to that key lives on a remote server: http://www.example.com/files/1234.pdf

What's the best way to get that remote file to the user, but hide the filename? I know how to set the Content-disposition header, I'm more interested in how I should best transport that file from the remote server to the local server and not leave behind orphaned files or use up all my RAM.

For example, if I download the remote file into a MemoryStream and serve it back to the user, there's definitely a possibility that I'll get OutOfMemory errors because of big files.

If I download the remote file and save it to disk, there's a chance the user could cancel the download and leave behind the temp file. Yes, I could create a scheduled task to clean up, but I don't really want to do that.

Is there a solution I haven't thought of, or so I just need to choose the least hassle of the ones I already outlined?

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members