Export report to PDF in ASP.NET - Logon Failed.
Posted on 2003-11-10
I have been all over the web looking for an answer to my problem and none of the solutions seem to be exactly right for my situation.
ASP.NET page using C#
I have a Crystal report that connects to an XML file (That is the Database Type is "ADO.NET (XML)".
The .aspx file is essentially empty (as created by VS.NET2003).
In the codebehind page, I have the following code:
private void Page_Load(object sender, System.EventArgs e)
ReportDocument crReportDocument = new ReportDocument();
ExportOptions crExportOptions = new ExportOptions();
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
String Fname = "";
Fname = "c:\\TEMP\\" + Session.SessionID.ToString() + ".pdf";
crDiskFileDestinationOptions.DiskFileName = Fname;
crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
Response.ContentType = "application/pdf";
This is the only code in the ASPX page (codebehind).
When I run this page on my dev machine, everything looks good.
When create a setup projet and deploy it to my server, I get the good old "Logon failed" error:
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Things I have tried:
1. Changing the machine.config ProcessModel username and restarting IIS
2. Making sure that the setup projet has the following merge modules
- Crystal_regwiz2003.msm (including the key)
4. Giving ASPNET read/write access to the app folder as well as the C:\Temp folder used to export the PDF.
Many solutions talk about adding proper credentials using code similar to this:
TableLogOnInfo crLogonInfo = new TableLogOnInfo();
crLogonInfo = crReportDocument.Database.Tables.LogOnInfo;
crLogonInfo.ConnectionInfo.ServerName = "myServer";
crLogonInfo.ConnectionInfo.UserID = "sa";
crLogonInfo.ConnectionInfo.Password = "sa";
crLogonInfo.ConnectionInfo.DatabaseName = "?";
However, since I am using an XML file for my datasource, I do not know what to use for username and password, as well as Server and DatabaseName.
Since this works fine on my local workstation I'm guessing that files are still missing in the setup... any help would be greatly appreciated!