0

I'm currently building a web page that will serve customers with files relevant for products they bought from us. The web server is located on a remote web host, but the files I want to serve are located on a local FTP server.

Right now the client logs on to the web host and, depending on its credentials on the web page, receives a file listing from the corresponding account on our local FTP server. The client can download the files because I'm directing the link directly to the FTP server. However, I want to change that so that it is the web host that is serving the file, not the FTP server (but I obviously don't want to store the files on the web host).

So, upon request the web app should fetch a certain file from the FTP server (using SSL, I might add) and then forward it to the client via HTTP (not SSL).

Also, it would be freaking awesome if the client can start receiving the file immediately from buffer while it is being fetched from FTP :P

How can I do it?

2
  • Not sure about the "obvious" part about not storing the files on the web host. This is by far the easiest solution. Having the site fetch the files and emit them to the client will just double up your bandwidth usage. Commented Jan 31, 2011 at 15:58
  • Hey Chris, what I mean by "obviously" is that I can't do it that way for several reasons, that's why I'm trying this route. Otherwise, yeah, it's the easiest way.
    – Jdiddy
    Commented Jan 31, 2011 at 16:35

1 Answer 1

1

I am not sure of the reasons you want to do this since it unnecessarily adds a lot of intermediate layers and work, but if you still want to then use the FTP request client in .NET, buffer the file you want to serve and then simply open the response stream from your web application to serve this buffer directly via your web application.

It is a lot of unnecessary work for your web server instead of simply saving these files in a protected folder on the web server itself.

3
  • Hey Raj, thank you for your reply. I'm gonna try out what you said. Also, it's only unnecessary if there are no reasons ;)
    – Jdiddy
    Commented Jan 31, 2011 at 16:14
  • I agree with simply saving these files in a protected folder on the web server, if possible.
    – Jordan
    Commented Jan 31, 2011 at 16:15
  • Hi Jordan. Having the files on the web server is unfortunately not an option, thanks anyway.
    – Jdiddy
    Commented Feb 2, 2011 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.