Within my vs2014 asp.net vb.net application, I give the user the option to download the report to a pdf for a printer friendly version of view the report in a viewer. The code below works fine on my development pc but when I published to a Windows 2012 Server (IIS 8) I receive the following error:
Error: Unable to cast object of type 'FileStreamDeleteOnClose' to type 'System.IO.MemoryStream'.
I had installed the Crystal report for visual studio SP 17. I can supply more information if necessary.
Here is a copy of my code, can anyone direct me on how to fix this error? Thanks!
Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New _
DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
CrDiskFileDestinationOptions. DiskFileName = "C:\YReport.pdf"
CrExportOptions = objReport.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType. PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
objReport. ExportToHttpResponse( ExportFormatType. PortableDocFormat, Response, True, "report")
Catch ex As Exception
Response.write(ex.ToString)
End Try