One method you could use is to create as Web Service on the server hosting
the files. The a request can be made to your public server where an aspx
page will do any necessary processing to check there allowed to download the
requested file or not. The aspx page then set the response header
context-type to text/html, image/gif etc. or whatever you data file is.
Using SAOP you can then connect to your file server and request the file.
This will stream the file across in predefined chunks, which you write
direct to the response buffer and flush the results. You then request the
next chunk through the web service interface until the entire file has been
transferred. The method of requesting the next buffer can be accomplished in
several ways but by far the simplest is to use the current offset. For
example offset of 0 will send the first chunk of the file and you increment
the position by the size of the buffer until the entire file has been
received. This will allow the client side (web server) to specify the size
of the buffer as well so you can control the speed at which the user
receives the file. i.e. The higher the user status the faster you will try
and stream the file to them.
- Mike
---------------------------------------------------------------------------------
http://www.cogitar.net"> Cogitar Software. (
http://www.cogitar.net )
http://www.web-dominion.co.uk Web-Dominion. (Web Design and hosting )
http://www.shop-dominion.com (senery landscape picture gallery)
---------------------------------------------------------------------------------
"Jatin" <Ja***@discussions.microsoft.com> wrote in message
news:D6**********************************@microsof t.com...
Hey Guys
I have a web application that allows users to download files. But the
files
are not hosted on the webserver. The files are stored on external servers
and
are referenced by a URL/URI. Since my application restricts the number of
downloads for the file per user, i cannot show the user the URL/URI of the
server hosting the file.
Therefore i need to some how route the file via my webserver, and then use
the Response to stream the stream to the client.
I have tried to work with the Webclient class, but the only download
method
i could use is readopen(others download the file directly to local drive),
which works BUT since it downloads the whole file into a Byte[] which i
then
use the response to stream to the client is not the best of ways since the
Byte[] is in memory and the files being downloaded can be large.
Please Help., someway i can use some sort of unbuffered stream to do the
trick.