Access to report file denied - Crystal Report error

I have a simple web app that I'm developing in VB.NET in Visual Studio 2005.  It pulls values from a database and sends them to a Crystal Report RPT file to generate a PDF.  All of this works fine in debugging mode in VS on my webserver; when it loads the webpage via localhost, my PDF is generated no problem.

I cannot get it to work over the Internet.  I've got the web app's directory configured in IIS as a virtual directory, and I've tried this both with precompiled and un-compiled files.  Either way, I get the following error:

Error in File C:\WINDOWS\TEMP\Statements_Web_Final {54C2CC68-48EE-41E5-896B-F732A10E21EA}.rpt:
Access to report file denied. Another program may be using it.

Note #1 - I don't think this problem has anything to do with the Crystal 15-reports-at-a-time licensing issue, as has been mentioned in other expert solutions.  My web app fails to generate even a single report.

Note #2 - I tried changing the temp directory in the project's web.config file, and I made sure that folder allows full access for Everyone.  However, it's still trying to write to the C:\Windows\Temp folder (and in fact, every time I run my page, it does create an RPT file in the Windows temp folder).

Who is Participating?
CodeCruiserConnect With a Mentor Commented:
Crystal Reports uses the folder in the TMP environmental variable to store its temp files. You can change the TMP environment variable to whatever location you want and it should work.

System.Environment.SetEnvironmentVariable("TMP", TempRoot)
Also does the web user have permissions to the server temp directory?

It won't be running on the local box.

Bobaran98Author Commented:
Awesome.  Thank you!  I had the correct temp directory specified in my webconfig file, and I tried the code from the link you gave me... still didn't work (error message still indicated it was trying to access C:\Windows\Temp).  However, I tried just setting that TempRoot variable directly, and it worked like a charm.  Thank you!  I feel better about kicking back for the weekend now. :-)
Bobaran98Author Commented:
Thanks for the attention, mlmcc.  Yes, the web user had permission.
I am glad your problem is solved now.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.