Export crystal to pdf in asp.net page

P

poppy

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,836
Messages
2,569,750
Members
45,545
Latest member
rapter____0

Latest Threads

Top