Crystal Reports may generate some temporary files (‘*.tmp’, ‘*.rpt’) in a temp folder (typically the c:\windows\temp folder or you temp folder in “Local Settings”). This is not a big deal because these files are quite small (between 0k and 200k for the ones I have seen during my investigations) but it can be a potential problems as they are very numerous (till 10 for a single export) and contains some potentially sensitive information (some data of your exports).
I have seen that these files are generated by the following methods:
How to correct this problem ?
Be sure to call the “Close()” method on your report object. This will automatically delete all the temporary generated files. In fact almost all of them as you will still have a “temp_xxx.rpt” file generated, even if you call the ExportToStream method.
Be sure to call the “Dispose()” method so Crystal Reports will release all the locks it may have on the object and the last generated file will be deleted
Of course, you could call only the “Dispose()” method as it will call internally the “Close()” method, or even not calling any of them but using the “using” syntax