on 05-27-2016 6:43 AM
Hi,
I am having trouble troubleshooting the cause of my error when attempting to export a pdf report.
Dim filename As String
filename = Request.QueryString("report") & "_" & Request.QueryString("user") & "_" & DateTime.Now.ToString("yyyyMMddHHmmss") & ".pdf"
exportPath = Request.PhysicalApplicationPath & filename
Try
myReport.ExportToDisk(ExportFormatType.PortableDocFormat, exportPath)
Catch ex As Exception
Response.Write("Export Error: <BR>")
Response.Write(exportPath)
Response.Write("<BR>")
Response.Write(ex.Message.ToString())
End Try
This code will fail, with the following displayed:
Export Error:
C:\websites\reporttest\reports\testreportbyparam4_batch_20160527151754.pdf
The system cannot find the path specified.
The directory exists.
I am attempting to call my using a vb.net aspx page with a URL like:
http://localhost/reporttest/reports/OpenReport.aspx?report=testreportbyparam4
where the report name and connection parameters are passed in the the Request scope variables
The report testreportbyparam4.rpt exists in the directory
e.g
Dim reportPath As String
reportPath = Server.MapPath(Request.QueryString("report") & ".rpt")
myReport.Load(reportPath)
I have a virtual directory setup to the reporttest folder under IIS.
If I don't catch the error, my stack trace is as follows:
[COMException (0x80004005): The system cannot find the path specified.
]
CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +1140
CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +650
CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) +208
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName) +276
OpenReport.ConfigureCrystalReports() +3158
OpenReport.Page_Init(Object sender, EventArgs e) +7
System.Web.UI.Control.OnInit(EventArgs e) +92
System.Web.UI.Page.OnInit(EventArgs e) +12
System.Web.UI.Control.InitRecursive(Control namingContainer) +134
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +489
I was wondering could it be a permissions problem? I don't really know enough about aspx websites to troubleshoot
I am using Visual Studio 2012, and the the project references the CrystalReportsEngine 13.0.2000.0
Hi,
The problem I was experiencing was one of two potential problems
1. I moved the login code after the set parameter code ( I read about this is a different post )
2. I changed the report data-source from ODBC to MS SQL Ole DB ( Ado )
Either way, the report's export now.
Thanks for taking the time to reply, I appreciate the time taken.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, give IIS access to the folder and full read/write permissions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.