Visual studio Crystal reports not showing up images

In one of our projects in Visual Studio, we had used crystal reports for reporting purposes. Some reports have charts like bar graph and pie charts in addition to displaying text data.

Crystal reports generate png images using a crystal report handler dll for the charts at runtime. Images are temporarily saved in windows temp folder. On several occasions, I have observed that images corresponding to the charts would stop displaying. Unfortunately, every time I ran into this problem root cause was different. Following is the list of causes, I have seen so far:

1. TEMP and TMP not being set in environment variables.
2. TEMP and TMP value is set to a user specific folder %document setting%… and folder is not accessible by the system or logged user. It better to have non user specific path like “C:temp” instead.
3.IIS user does not have rights to write to temp folder
4. “Check file exists” option is checked in IIS. Crystal reports generates png file at the runtime using crystalreporthander dll and url is build dynamically. So, if this option is checked in IIS does not find the file and errors out. Unchecking “Check file exists” options, fixes the problem.