Dexter
Dexter

Reputation: 245

ASP Response.AddHeader Content-Disposition not working for Acrobat

I have a script that generates a temporary PDF file, binary-streams it to the client, then deletes it.

If you click on "Save Page As" in the browser File menu, it wants to save the correct file name that I specified through Content-Disposition.

However, if you click on the Save button in the Acrobat reader or Acrobat Pro, it wants to save the name of the script file, replacing ".asp" with ".pdf". It's like Acrobat completely ignores "Content-Disposition"

It's important that I don't use a static URL, but instead use a Dynamic script to generate the PDF, so that I can delete it immediately upon closing the stream. Otherwise, I can't know when the client is finished downloading.

Is there a solution to this? I've seen several threads, but none with an answer.

Upvotes: 0

Views: 931

Answers (1)

Oded
Oded

Reputation: 499352

You can use a URL rewriter to point a "static" path to your dynamic script.

See this blog post on classic asp redirection.

So, you can have a link like:

http://www.example.com/12_234_file.pdf

Redirect to:

http://www.example.com/dynamic.asp?id=12&id2=234

The client will see the URL before it was re-written and should use that.

Upvotes: 1

Related Questions