streaming reports from report services
Brought to you by:
wrowe
From: David M. <wo...@su...> - 2008-10-20 16:53:39
|
<HTML> <P>I have applications written in Visual Web Developer 2005 that work fine, except for streaming reports. This works fine on IIS and I want it to work on Apache. A PDF is streamed to the client and the "open, save, cancel" dialog appears. Code to create the report is:</P> <P> Dim localReport As New Microsoft.Reporting.WebForms.LocalReport<BR> localReport.ReportPath = Server.MapPath("~/OnCallReport01.rdlc")<BR> Dim command As New Data.SqlClient.SqlCommand(sql & " ORDER BY InSort", connect)<BR> Dim reader As Data.SqlClient.SqlDataReader = command.ExecuteReader<BR> localReport.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("DataSet1_DataTable1", reader))<BR> Dim parameter() As Microsoft.Reporting.WebForms.ReportParameter = {New Microsoft.Reporting.WebForms.ReportParameter("Report_Parameter_0", tit)}<BR> localReport.SetParameters(parameter)<BR> SubReportConnect = New Data.SqlClient.SqlConnection(DefaultConnect)<BR> SubReportConnect.Open()<BR> SubReportCommand = New Data.SqlClient.SqlCommand("", SubReportConnect)<BR> AddHandler localReport.SubreportProcessing, AddressOf OnCallReportSubreportProcessingEventHandler<BR> Dim bytes As Byte() = localReport.Render("PDF", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)<BR> If Not IsNothing(SubReportReader) Then SubReportReader.Close()<BR> SubReportReader = Nothing<BR> SubReportConnect.Close()<BR> SubReportConnect = Nothing<BR> reader.Close()<BR> reader = Nothing<BR> Response.Clear()<BR> Response.ContentType = ""<BR> Response.AddHeader("content-disposition", "attachment; filename=OnCallReport.pdf")<BR> Response.BinaryWrite(bytes)<BR> Response.End()<BR> </P> <P> Public Sub OnCallReportSubreportProcessingEventHandler(ByVal sender As Object, ByVal e As Microsoft.Reporting.WebForms.SubreportProcessingEventArgs)<BR> SubReportCommand.CommandText = "SELECT Person.*,AtName,AgAbbreviation FROM Assignment LEFT JOIN Person ON Assignment.AsPnUnique=Person.PnUnique LEFT JOIN AssignmentType ON Assignment.AsAtUnique=AssignmentType.AtUnique LEFT JOIN Agency ON Person.PnAgUnique=Agency.AgUnique WHERE AsInUnique=" & e.Parameters("InUnique").Values(0) & " ORDER BY AtFunctionalOrder, AtName, AsCallOrder"<BR> If Not IsNothing(SubReportReader) Then SubReportReader.Close()<BR> SubReportReader = SubReportCommand.ExecuteReader<BR> e.DataSources.Clear()<BR> e.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("DataSet1_Persons", SubReportReader))<BR> End Sub</P> <P>The asp.net portion of httpd.conf is:</P> <P>#asp.net <BR> LoadModule aspdotnet_module "modules/mod_aspdotnet.so" <BR> AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo <BR> AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4" <BR> #On Call<BR> AspNetMount /oncall "C:/David/VS2005/WD/Projects/OnCall"<BR> Alias /oncall "C:/David/VS2005/WD/Projects/OnCall"<BR> <Directory "C:/David/VS2005/WD/Projects/OnCall"><BR> Options FollowSymlinks Indexes<BR> AspNet files<BR> Order allow,deny<BR> Allow from all<BR> DirectoryIndex OnCallInventory.aspx<BR> </Directory><BR> #reporting01<BR> AspNetMount /Reports$SQLExpress "c:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportManager"<BR> Alias /Reports$SQLExpress "c:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportManager"<BR> <Directory "c:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportManager"><BR> Options FollowSymlinks Indexes<BR> AspNet files<BR> Order allow,deny<BR> Allow from all<BR> DirectoryIndex Home.aspx<BR> </Directory><BR> #reporting02<BR> AspNetMount /ReportServer$SQLExpress "c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer"<BR> Alias /ReportServer$SQLExpress "c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer"<BR> <Directory "c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer"><BR> Options FollowSymlinks Indexes<BR> AspNet files<BR> Order allow,deny<BR> Allow from all<BR> DirectoryIndex Default.aspx Default.htm Default.asp index.htm iisstart.asp<BR> </Directory><BR> #asp.net</P> <P>Thanks</P> <P> </P> <P><BR> -- <BR> dgm <BR> </P></HTML> <BR> |