Wayne,
You do the same thing as you would do in ASP. Use the Response object, clear
the existing headers, output the headers with your content-length,
content-disposition, etc, and then spit out the bytes for the pdf. That way,
you avoid meta-tags (and instead use the true headers), so it will work on
more browsers. To support even more browsers, change
<a href="download.aspx?docid=4" target=_new>Click</a>
to
<a href="download.aspx?docid=4&fake=.pdf" target=_new>Click</a>
As some old, non standard browsers allow a document extension to override
the mime headers.
If you need a code example, let me know and I'll send you one.
Erick
----- Original Message -----
From: "Wayne Lee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 11:16 AM
Subject: [DOTNET] PDF Downloads
Hi all,
Great list this!! Well impressed after 4 hours!! ;)
I have an asp.net app written using c#. What I'd like to do is when
someone clicks a hyperlink, say:
<a href="download.aspx?docid=4" target=_new>Click</a>
I'd like that to open a new page, run a db query which returns the
filename of that doc, and triggers the download of the pdf. After
looking on the web and looking at the old "content-disposition" meta tag
and the binarywrite method that were prevalent in ASP3 that we used to
use, there doesn't seem to be any new way?
Maybe I'm being na�ve thinking there would be a new method with .NET! :)
Anyway if anyone knows the best way to go about this procedure it would
be much appreciated.
Thanks and long live the list!
Wayne Lee
Evident Systems Ltd
SQL/.NET Senior Developer
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.