Tuesday, March 15, 2005 12:01 PM
Crystal Reports .NET Error - "Access to report file denied. Another program may be using it."
From the been there, done that, beat my head against the wall until I figured it out file:
This is a very misleading error message, and usually has nothing to do with another program. The actual filename will differ based on your configuration, but the entire error message will be the same, similar to what's shown below.
Error in File C:\DOCUME~1\FFUK\ASPNET\LOCALS~1\Temp\temp_9ff883f0-88e3-469c-a942-092ca424001a.rpt: Access to report file denied. Another program may be using it.
In this example (http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=574159), the code was listed, setting the output file as such:
DiskOpts.DiskFileName = "C:\Output.pdf"
Usually, the ASPNET user does not have write permission granted to it, and especially not on the root directory. The solution in this case was to change the output directory to a subfolder of the web root, and grant ASPNET Modify permissions on that folder. If you're using Windows Server 2003, you need to grant permissions to Network Service, not ASPNET.
If you have configured your application to run as a user other than ASPNET, you need to make sure that user has the permissions described above. On Windows Server 2003, you need to grant permissions to NetworkService user, not ASPNET. The .NET Framework on Win2K3 uses NetworkService, while on Win2K, ASPNET.
Crystal Reports .NET Programming
If you're new to Crystal Reports, or just to CR .NET, this is the book you need. Part how-to, part programming reference, lots of simple examples in both C# and VB.NET.