Reputation: 51927
When I use
Path.GetTempFileName();
It creates a file in the current user’s profile that is readable by the current user; however the file can’t be read by all services on the machine. (As services run under their own accounts.)
I need to pass the path of the newly created file to a service running on the same machine, then that services has to read its contents (don’t ask why!).
So I am just looking for a way to create a system-wide temp file without assuming the layout of the machines disks.
Upvotes: 0
Views: 99
Reputation: 42494
You can use
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
And generate/create a file there.
Reference to the Enumeration.SpecialFolder and the GetFolderPath documentation at MSDN.
Upvotes: 1