Export crystal to pdf in asp.net page

Discussion in 'ASP .Net' started by poppy, May 5, 2005.

  1. poppy

    poppy Guest

    I am generating a Crystal report in an asp.net application
    and keep getting the following error message when I try to
    export the report to pdf format.

    "CrystalDecisions.CrystalReports.Engine.LogOnException:
    Logon failed"

    I have crawled everywhere on the web and have found a lot
    written about this problem but all info relates to binding
    your report to sql server. In my case I am binding to an
    xml file.

    It is driving me insane !!!
    If I just display the crystal report in a viewer on a
    webpage it works fine. Its only when I try to export it
    that I have the problem. I have already given the ASP.net
    user write privs to the folder.
    Heres my code :


    <code>
    Dim crReportDocument As ReportDocument
    Dim crExportOptions As exportoptions
    Dim crDiskFileDestinationOptions As diskfiledestinationoptions
    Dim Fname As String
    crReportDocument = New ReportDocument
    crReportDocument.Load("C:\inetpub\wwwroot\TTPresentation\reports\timesheetReport1.rpt")
    Fname = "C:\inetpub\wwwroot\TTPresentation\reports\" &
    "test" & ".pdf"
    crDiskFileDestinationOptions = New
    DiskFileDestinationOptions
    crDiskFileDestinationOptions.DiskFileName = Fname
    crExportOptions = crReportDocument.ExportOptions
    With crExportOptions
    ..DestinationOptions = crDiskFileDestinationOptions
    .ExportDestinationType =
    ExportDestinationType.DiskFile .ExportFormatType =
    ExportFormatType.PortableDocFormat
    End With
    crReportDocument.Export() Response.ClearContent()
    Response.ClearHeaders()
    Response.ContentType = "application/pdf"
    Response.WriteFile(Fname)
    Response.Flush()
    Response.Close()
    System.IO.File.Delete(Fname)
    </code>

    I can honestly say that this problem is the most annoying I
    have ever had.

    Help me or put me out of my misery.
    poppy, May 5, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=

    Export PDF from Crystal Report .NET using ASP.NET

    =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=, Feb 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,817
    =?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=
    Feb 5, 2004
  2. =?Utf-8?B?TWFuZGFy?=

    Export from crystal report to pdf

    =?Utf-8?B?TWFuZGFy?=, Jul 28, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    8,947
    Andrew
    Aug 12, 2004
  3. Colin Graham
    Replies:
    0
    Views:
    1,439
    Colin Graham
    Nov 17, 2004
  4. Colin Graham
    Replies:
    1
    Views:
    173
    Scott Mitchell [MVP]
    Nov 17, 2004
  5. Maarten Porters
    Replies:
    1
    Views:
    414
    Florian Gilcher
    Jul 28, 2008
Loading...

Share This Page