public FileStreamResult getReportCotizacion(String id, String flg_docto) { Reporte rpt = new Reporte(); String error; String idVersion = id; String tip_docto = flg_docto; rpt.CargaReporteCabeceraDt(idVersion, out error); //ReporteCabeceraDt rpt.CargaReporteComponenteDt(idVersion, out error); //reporte dt rpt.CargaReporteServicioDt(idVersion, out error); rpt.CargaTotalServicios(idVersion, out error); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; reportViewer.LocalReport.ReportPath = "Content/Reportes/CotizaRpt.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReporteDt", rpt.ReporteDt)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReporteDt2", rpt.ReporteDt2)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReporteCabeceraDt", rpt.ReporteCabeceraDt)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReporteTabServicios", rpt.ReporteDt2)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("TotalServicios", rpt.TotalServicios)); Warning[] warnings; string[] streamids; string mimeType; string encoding; String filenameExtension; reportViewer.LocalReport.Refresh(); byte[] pdf = reportViewer.LocalReport.Render( tip_docto, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); MemoryStream ms = new MemoryStream(); ms.Write(pdf, 0, pdf.Length); ms.Position = 0; if (tip_docto.Equals("PDF")) { return(new FileStreamResult(ms, "application/pdf")); } else { return(new FileStreamResult(ms, "application/vnd.ms-excel")); } }