Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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):

  1. User requests file by clicking link
  2. Request is sent to server A and it disables the link via ajax
  3. Server A copies the file to a temporary directory from server B
  4. Server A sends back a link to the file in the temporary folder

This would work if the document server was not a webserver (SMB, AFS, NFS, etc).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top