Thursday, January 10, 2008

Crystal Reports - Access to report file denied

January 10, 2008 Posted by Jason Irwin 1 comment

Recently I had to set up some virtual development and testing servers for some of our ASP.NET apps. Some existing servers were being retired and it was a good time to clean up the existing environments. The task was simple, install Windows 2000, SQL 2000, IIS 6 and promote our existing dev/test apps. Or so I thought….

Everything ran smoothly until I decided to test our reporting functionality and I was hit with an error message that appears to be pretty common:

"C:\DOCUME~1\<server>\ASPNET\LOCALS~1\Temp\<temp report file>.rpt: Access to report file denied. Another program may be using it."

My original thought, and seemingly the one with the greatest possibility for success, was granting appropriate permissions to this temp folder. A quick (unnecessary) perusal of the code confirmed that the file was being output to the current working directory - the temp folder of the ASP.NET account. So I gave ASP.NET write access to this folder….still no good. The same message appeared! A little confused, I gave ASP.NET full control of the folder - a temporary measure to determine if this was indeed the issue. Alas, still nothing! So I gave everyone full control….and yet I received the same message.

Much time passed, much frustration ensued, much googling was done, and yet I consistently received this error. So I swallowed my pride and did what I should have done the previous afternoon - asked for help. Lo and behold, a colleague had faced the same challenge a few years back.

The answer, on Windows 2000 at least, was to give the ASP.NET account write access to the wwwroot folder! I haven't yet been able to determine why that fixed my issue (though I will follow up when I do), but until next time I am content.