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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.