views:

60

answers:

2

I have a windows service which needs to write some files to disk, if I don't specify a path it tries to write them to system32 folder which throws an exception because the service is being executed under the localservice account, I would like to know which is the recommended location to save this files and which folder I could use so I don't get permission exceptions?

+3  A: 

One logical place is the system temp folder, but it would really depend on what you were doing. Is the storage supposed to be persistent or temporary? How secure does it need to be? Would it be better stored in a database than the file system? All of these are things that I would consider.

tvanfosson
A: 

I would recommend to use the IsolatedStorage. The API is not straight forward but it is ideal for temporary storage and works on every machine as soon as .NET is installed.

Bernd