Question

I am creating a program that consists of a (1) Windows Service and a view (2) WPF Application. (the view and service do not have to be run at the same time) I will like to save all the settings on the same location. I was thinking to save all the settings on my application data directory. Because (1) and (2) are run by different users, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) returns a different directory for each. How can I save both my wpf and windows service data on the same directory?

When I initialize my wpf application I will like to read some of the files created by my windows service. where should my windows service write files so that my wpf application can see them?

Was it helpful?

Solution

You want CommonApplicationData, instead, the "common repository for all application-specific data that is used by all users," as MSDN puts it under SpecialFolder.

However, there are at least some cases where permissions conflict, so make sure the ACLs are set correctly.

This sample code may help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top