Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Comma appended to filename of streamed file

Comma appended to filename of streamed file

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netsysadminwindows-admin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tantiboh
    wrote on last edited by
    #1

    I'm generating reports using Business Objects (aka Crystal Reports) XI release 2. I'm running ASP.NET 2.0. Here's the relevant code (C#): CrystalDecisions.CrystalReports.Engine.ReportDocument rdReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); //Uses the full physical file path of the report file on the IIS server. rdReport.Load(strReportFilePath); //Sets the report's data source to the dataset just generated. rdReport.SetDataSource(dsReport); //Clear the current page Response.ClearContent(); Response.ClearHeaders(); //Output the crystal report in PDF format to the page. Response.ContentType = "application/pdf"; Response.AppendHeader("Content-disposition", "inline; filename=test.pdf" ); rdReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, ""); The problem is that that file generated is named "test.pdf," insead of "test.pdf". It doesn't matter what file format the export is (ie .doc, .xls, .pdf, .rtf, etc.), whether or not the extension is included, or whether the "test.pdf" is replaced by a variable. The system always appends a comma to the end of the file name. Any ideas? Thanks for your help!

    M 1 Reply Last reply
    0
    • T tantiboh

      I'm generating reports using Business Objects (aka Crystal Reports) XI release 2. I'm running ASP.NET 2.0. Here's the relevant code (C#): CrystalDecisions.CrystalReports.Engine.ReportDocument rdReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); //Uses the full physical file path of the report file on the IIS server. rdReport.Load(strReportFilePath); //Sets the report's data source to the dataset just generated. rdReport.SetDataSource(dsReport); //Clear the current page Response.ClearContent(); Response.ClearHeaders(); //Output the crystal report in PDF format to the page. Response.ContentType = "application/pdf"; Response.AppendHeader("Content-disposition", "inline; filename=test.pdf" ); rdReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, ""); The problem is that that file generated is named "test.pdf," insead of "test.pdf". It doesn't matter what file format the export is (ie .doc, .xls, .pdf, .rtf, etc.), whether or not the extension is included, or whether the "test.pdf" is replaced by a variable. The system always appends a comma to the end of the file name. Any ideas? Thanks for your help!

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, There are a couple of things that you might check to narrow the scope of your finding: + Do you call the Response.End() after data is sent to the output stream of the Response object? + Are you sure that you use the inline parameter instead of the attachment? + Does it work in the ASP.NET 1.1? + Have you tried to simply send the content of a file to the output stream of the Response object and see if you can get the correct file name at the client side?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups