Subject: Web-Based Printing
Posted By: toekneel Post Date: 10/14/2004 11:57:57 AM
I'm using WROX's Professional Crystal Reports for Visual Studio .NET 2nd Edition to try to create my first CR.NET application for a major project at work.  I've got most things figured out, but have printing and exporting to take care of at this time.

On page 182 there is a description of how to print the report by pushing it into an adobe acrobat plug-in.

After following the instructions to the letter on two separate files, I'm getting the same error message.  Can anyone help me overcome this spot?  Am I right in thinking that the program using the file at the time of this error is my own program?  HELP!!



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: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Error in File C:\DOCUME~1\TLENIN~1\ASPNET\LOCALS~1\Temp\temp_15675fa6-0611-46d1-8cee-760821443e02.rpt: Access to report file denied. Another program may be using it.

Source Error:


Line 55:         End With
Line 56:
Line 57:         myReport.Export()
Line 58:
Line 59:         Response.ClearContent()
 

Source File: c:\inetpub\wwwroot\web_viewer_print\WebForm1.aspx.vb    Line: 57

Stack Trace:


[LoadSaveReportException: Error in File C:\DOCUME~1\TLENIN~1\ASPNET\LOCALS~1\Temp\temp_15675fa6-0611-46d1-8cee-760821443e02.rpt:
Access to report file denied. Another program may be using it.]
   .I(String , EngineExceptionErrorID )
   .D(Int16 , Int32 )
   .C(Int16 )
   CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
   CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
   web_viewer_print.WebForm1.PDF_Button_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\web_viewer_print\WebForm1.aspx.vb:57
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain()

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Reply By: toekneel Reply Date: 10/15/2004 5:13:51 PM
Finally got this one figured out.  Instead of placing the code for loading the report in a form load event, I moved it into the Page_init event.  I did end up having to copy my code for logging into data tables over again into the export section, but finally got it to work properly.  Another key here was help from WROX tech Ian Hays:

Have you set the folder containing the web app permission for ASP.NET? In order to do this go to the folder that contains your web app and right click on it and go to properties. Click on the security tab and click add. Then click locations and select the location that you want and click okay. In the text box labeled "Enter the object names to select" type in "ASPNET" and click okay.

After these changes, I got past my hurdle.  If you're struggling with this one, I recommend you do Ian's fix first, then if there are other hurdles, consider doing what I did.

Reply By: janedong Reply Date: 11/14/2004 9:48:09 PM
Thanks!


Go to topic 21939

Return to index page 716
Return to index page 715
Return to index page 714
Return to index page 713
Return to index page 712
Return to index page 711
Return to index page 710
Return to index page 709
Return to index page 708
Return to index page 707