从内部服务器向外部下载文档
这有点奇怪......我们有一个在服务器 (A) 上运行的内部 Web 应用程序和一个在服务器 (B) 上运行的文档存储库。
我在页面上有简单的链接,我想让用户能够下载文档(从 IIS 服务器 (A))。 然而,在用户单击按钮之前,该文档在服务器(A)上并不存在(因为有 40 多个要显示的文档,在页面加载时无法加载所有文档)
当用户单击链接时(此时我想会提示下载) 该文档被复制到服务器 (A),然后重定向到浏览器提示下载的页面。 我相信我已经正确设置了内容标题并且它可以在 FireFox 中运行。
IE(7) 只是弹出一个窗口,然后窗口消失,如果我关闭安全设置,它可以正常工作,但这不是一个选项。
任何想法如何解决这个问题。 我无法直接指向 Server(B) 上的文档
另外:是的 Server B 也是 Web 服务器
This a bit of strange one.... We have an internal web app that runs on server (A) and a document repository that runs on server (B).
I have simple link on a page and I want to enable the user to download a document(From IIS Server (A)). However this document does not exist on Server (A) until the user clicks the button(because there is 40+ documents to display cannot load them all when the page loads)
When the user clicks the link(at which point I would like then to be prompted to download)
The document is copied to server (A) and then redirected to a page where the browser prompts them to download. I believe I have set up the content header correctly and it works in FireFox.
IE(7) just pops up a window and then the window disappears, If I turn down the security settings it works OK but that is not an option.
Any Ideas how to solve this. I cannot point directly to the document on Server(B)
ADDITION: Yes Server B is also a Web Server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以用ajax吗? 例如,用户单击按钮发送请求以将文件从 B 获取到 A,页面上会显示一个微调器。 然后,当复制完成后,您禁用微调器并为用户提供下载链接。
我被否决了,没有评论权限,所以我想我应该在这里详细说明(也许这只是一个糟糕的解决方案,我看不到它):
如果文档服务器不是 Web 服务器(SMB、AFS、NFS 等),这将起作用。
Can you use ajax? For example, the user clicks the button sending a request to get the file from B to A and a spinner shows up on the page. Then when the copy is done, you disable the spinner and give the user a download link.
I was voted down and don't have comment privileges, so I figured I would elaborate here (perhaps this is just a terrible solution and I cannot see it):
This would work if the document server was not a webserver (SMB, AFS, NFS, etc).
如果世界可以看到服务器 A 并且服务器 A 可以看到服务器 B。我建议设置反向代理。
http://www.codeplex.com/urlrewriter
基本上,它的作用是允许世界从服务器 B 但只能通过反向代理。 您可以按照以下规则使用上面的库创建反向代理接口。
RewriteRule ^/download/(.*) http://server-b/download/$1 [NC, P]
的情况下
所以在http://server-a/download/xyz.pdf
它实际上会从
http://server-b/download/xyz.pdf
请求它,但是它会像来自服务器 a 一样进行传递,从技术上讲,这是通过反向代理创建从服务器 a 到服务器 b 的 Web 连接并将 HTTP 响应复制到服务器 a 的响应来实现的。
如果您需要任何帮助,请告诉我。
If the world can see server A and server A can see server B. I would recommend setting up a reverse proxy.
http://www.codeplex.com/urlrewriter
Basically what this does is allows the world to download from server B but only through the reverse proxy. You can create a reverse proxy interface with this library above with the following rule.
RewriteRule ^/download/(.*) http://server-b/download/$1 [NC,P]
So in the case of
http://server-a/download/xyz.pdf
it would actually request it from
http://server-b/download/xyz.pdf
but it would be delivered as if it was coming from server-a, this technically happens by the reverse proxy creating a web connection, from server-a, to server-b and copying the HTTP response to the response of server-a.
Let me know if you need any help.