David Emerson
newsgrps at dalyn.co.nz
Thu Dec 20 23:03:34 CST 2007
I looked and couldn't see the problems you were referring to. My app seems to work ok (fingers crossed). The only problem I have now is that if I want two different PDF's downloaded they can't be done. The reason seems to be that Respond.End() ends the scripting of the page. Here is my code (simplified): boolRPXReport = False Dim split As String() = strReportNoList.Split(New [Char]() {"|"c}) Dim strReportNo As String For Each strReportNo In split 'Code here gets values for strReportType intReport = CInt(strReportNo) If strReportType <> "pdf" Then 'Code here gets ActiveReport and adds it to rptCombined.Document boolRPXReport = True Else 'If the report is already a PDF then it should be downloaded separately Response.ContentType = "Application/pdf" Response.AppendHeader("Content-Disposition", "attachment; filename=" + strReportFile + ".pdf") Response.TransmitFile("D:\PDFFiles\" + strReportFile + ".pdf") Response.End() End If Next strReportNo If boolRPXReport = True Then 'Download the combined report PDF If Me.PdfExport1 Is Nothing Then Me.PdfExport1 = New DataDynamics.ActiveReports.Export.Pdf.PdfExport End If Me.PdfExport1.Export(rptCombined.Document, m_stream) m_stream.Position = 0 Response.ContentType = "application/pdf" Response.AddHeader("content-disposition", "attachment; filename=PVPBlankReports.pdf") Response.BinaryWrite(m_stream.ToArray()) Response.End() End If Is there any way for the code to continue processing each strReportNo even after one PDF has been downloaded? David At 21/12/2007, you wrote: >Looking through the comments from >http://www.west-wind.com/WebLog/posts/76293.aspx it appears that >Response.TransmitFile( Server.MapPath("~/images/sailbig.jpg") ); >will fail in some circumstances... one of the many reasons I prefer >working with desktop apps. > >good luck! > >Michael M > >From: dba-vb-bounces at databaseadvisors.com >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of David Emerson >Sent: Friday, 21 December 2007 1:57 PM >To: dba-vb at databaseadvisors.com >Subject: Re: [dba-VB] Launch and monitor external programs from .NET > >Michael, > >I looked at the two links. The first got me in the right direction but >didn't provide a direct solution. The second one was an addon for >Firefox which most of the users don't have. > >However, I have found a couple of links that might solve the problem: > >http://www.west-wind.com/WebLog/posts/76293.aspx > >http://aspalliance.com/259_Downloading_Files__Forcing_the_File_Download_ >Dialog > >David > > > >At 21/12/2007, you wrote: > >Hi David, > > > >I guess the links I sent you didn't do the job then... > > > >How about 2 links on the page, 1 to the pdf that will open it in the > >browser. > >The other to a zip of the pdf that can be downloaded. > > > >Too simple? ;-) > > > >cheers > > > >Michael M > > > >-----Original Message----- > >From: dba-vb-bounces at databaseadvisors.com > >[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of David Emerson > >Sent: Friday, 21 December 2007 1:27 PM > >To: dba-vb at databaseadvisors.com > >Subject: Re: [dba-VB] Launch and monitor external programs from .NET > > > >Group, > > > >I couldn't work out how this could be done so I am trying the group > >again. > > > >I am using VB.net in Visual Studio 2005. This is a web application. I > > >have code that gets the path and name of a pdf file located on a >server. > >What I want to do within the code is have a file download box open > >which gives the user an option of opening or saving the PDF file. > > > >The Process class doesn't deem to help because it tries to open the > >file on the web server (and not the user's). > > > >My.Computer.Network.DownloadFile Method seems to require a destination > >path and filename, but I don't want it to automatically be saved. > > > > > >Regards > > > >David Emerson > >Dalyn Software Ltd > >Wellington, New Zealand