c# - Copy file from remote server to client browser via my server without writing the entire file to disk or memory -
this scenario.
there file on remote file server (say have file hosted on dropbox)
i want offer file download on web application (c# asp.net 4.0)
i want hide location 100% of original file (i want appear come sever).
i not want write file memory or disk on server.
i had assumed want use stream stream copy. example
stream inputstream = response.getresponsestream(); inputstream.copyto(response.outputstream, 4096); inputstream.flush(); response.flush(); response.end();
this copies entire stream memory before writing out client browser. ideas awesome.
i need server act proxy , shield original file location
thanks help.
while don't see reasons why copyto
read whole stream in memory (as there no intermediate stream anywhere), can write same copy manually sure behaves way want.
consider using async versions of read/write , if can use async
/awit
c# 4.0 make code readable.
old way: asynchronous stream processing, new ways asynchronous file i/o
Comments
Post a Comment