I'm using the .net Crystal Reports viewer to display a report in an asp.net Web form. This works properly, but when I click on the print option, and then click "OK" on the options popup, I get the following error:
Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Runtime.InteropServices.COMException: Access is denied.
And the same thing when I try to export. I'm running this on the Visual Studio development server, VS2008. What can I do to correct this?
EDIT:
Here is some code.
txtCategory:
<asp:TextBox ID="txtCategory" runat="server"></asp:TextBox>
<br />
txtFromDate:
<asp:TextBox ID="txtFromDate" runat="server" TabIndex="1"></asp:TextBox>
<br />
txtToDate:
<asp:TextBox ID="txtToDate" runat="server" TabIndex="2"></asp:TextBox>
<asp:Button ID="btnShowReport" runat="server" onclick="btnShowReport_Click"
TabIndex="4" Text="Show Report" />
<br />
<br />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
</CR:CrystalReportSource>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="True" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False"
EnableParameterPrompt="False" HasRefreshButton="True" Height="50px"
ReportSourceID="CrystalReportSource1" Width="350px" />
And in Code-Behind:
protected void btnShowReport_Click(object sender, EventArgs e)
{
ReportDocument report = new ReportDocument();
report.Load(Server.MapPath(@"~\ReportFiles\CrystalReport.rpt"));
report.SetParameterValue("value1", txtCategory.Text);
ParameterRangeValue dateRange = new ParameterRangeValue();
CrystalReportViewer1.ReportSource = report;
}
STACKTRACE: at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()