Mark Carpenter
Mark Carpenter

Reputation: 17775

Where should I generate temporary files for my application?

I've been warned by several people not to store temporary files in the Temporary Internet Files directory. Where would be the best place to store any temporary or log files that my application generates?

Upvotes: 5

Views: 4748

Answers (3)

JaredPar
JaredPar

Reputation: 754565

Is there a reason you can't use the default temporary directory? Essentially use the name returned from Path.GetTempFileName?

Upvotes: 6

Raj More
Raj More

Reputation: 48018

Temporary Internet Files folder is different from the TEMP folder. I agree about not using the Temporary Internet Files folder - it is meant for a different usage.

The TEMP folder should be used for files that can be blown away without fear of crash.

The TEMP folder, however, is no place for log files or configuration files or anything of importance. I would create my own folder under the user's profile preferably in the Application Data or Local Settings.

Upvotes: 2

JP Alioto
JP Alioto

Reputation: 45117

You best bet is to use isolated storage for temp files, but you can also use GetTempFileName.

Upvotes: 10

Related Questions