从 FTP 到 Web 服务器再到 Web 客户端
我目前正在构建一个网页,将为客户提供与他们从我们这里购买的产品相关的文件。 Web 服务器位于远程 Web 主机上,但我想要提供服务的文件位于本地 FTP 服务器上。
现在,客户端登录到 Web 主机,并根据网页上的凭据,从本地 FTP 服务器上的相应帐户接收文件列表。客户端可以下载文件,因为我将链接直接定向到 FTP 服务器。但是,我想更改它,以便由 Web 主机提供文件服务,而不是 FTP 服务器(但我显然不想将文件存储在 Web 主机上)。
因此,根据请求,Web 应用程序应从 FTP 服务器获取特定文件(使用 SSL,我可能会添加),然后通过 HTTP(而不是 SSL)将其转发到客户端。
另外,如果客户端能够在从 FTP 获取文件时立即开始从缓冲区接收文件,那就太棒了:P
我该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你想要这样做的原因,因为它不必要地添加了很多中间层和工作,但如果你仍然想在.NET中使用FTP请求客户端,缓冲你想要服务的文件,然后简单地从您的 Web 应用程序打开响应流,以直接通过您的 Web 应用程序提供此缓冲区。
这对您的 Web 服务器来说是很多不必要的工作,而不是简单地将这些文件保存在 Web 服务器本身的受保护文件夹中。
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.