FYI, Response.ClearContent is exactly equivalent to Response.Clear (it calls Reponse.Clear). Response.ClearAll is the equivalent of calling Response.ClearHeaders followed by Response.Clear.
> -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > On Behalf Of Erick Thompson > Sent: Tuesday, May 28, 2002 3:47 PM > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] PDF Downloads > > > Wayne, > > Sure, no problem. In the Page_Load event handler, put in > something like > > Response.Clear(); > > Response.ClearHeaders(); > > Response.ClearContent(); > > Response.ContentType = "application/pdf"; > > byte[] pdf = GetPDF(); // this is any function that returns a > bunch of bytes > > Response.BinaryWrite(pdf); > > > And your good to go. > > Erick > > ----- Original Message ----- > From: "Wayne Lee" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, May 28, 2002 1:41 PM > Subject: Re: [DOTNET] PDF Downloads > > > Erik & peter, > > Thanks for your reply guys, a code some would be good eric if > you don't mind? > > I'm too tired now...but will look into this tomorrow, 10 > hours of .net...and I get tired...ZzZz... > > Cheers all > > > > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > On Behalf Of Erick Thompson > Sent: 28 May 2002 21:37 > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] PDF Downloads > > > 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. > > 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. > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.