Send MHTML Report via ASP.NET RRS feed

  • Question

  • I want to be able to send a Reporting Services report as MHTML automatically from ASP.NET.  It seems to work using a subscription but I'd like to send from ASP.NET.   I render the ReportViewer control as MHTML in a memory stream which gives me the report in a Byte array.  Then it gets converted to a string.  However when that is assigned to the body of the MailMessage it comes through as text and does not render as MHTML.  I'm guessing I'm missing a header or something.  Can anybody help me out?

    Code snippet:

    returnValue = ReportViewer1.ServerReport.Render("MHTML", "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>", mimeType, encoding, extension, streams, warnings)

    With msg

    Dim ms As New MemoryStream(returnValue)

    Dim sr As New StreamReader(ms)

    Dim res As String = sr.ReadToEnd

    .Body = res

    End With

    Message that comes through (only pasted top part):

    MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_01C35DB7.4B204430" X-MSSQLRS-ProducerVersion: V9.00.3042.00 This is a multi-part message in MIME format. ------=_NextPart_01C35DB7.4B204430 Content-Disposition: inline; filename="VP Claim Form" Content-Type: text/html; name="VP Claim Form"; charset="utf-8" Content-Transfer-Encoding: base64 PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNpdGlvbmFs Ly9FTiI+DQo8aHRtbD4NCjxoZWFkPg0KPHRpdGxlPg0KVlAgQ2xhaW0gRm9ybQ0KPC90aXRsZT4N CjxNRVRBIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFy

    Thanks for any help you can provide.

    Tuesday, August 28, 2007 3:42 PM