Summary: Several different users will use my application on a specific machine. I want the application to store its data in a single common file on this machine regardless of which user is running the application.
To achieve what I want, I am wondering whether this question might be relevant: Difference between 'SpecialFolder.LocalApplicationData' and 'SpecialFolder.ApplicationData'?
From that question and its answers it appears that:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
is specific to the machine. Some of the information I have turned up by googling confirms that. However, I have also found information that says that LocalApplicationData
is user specific.
So, which is true? And can anyone tell me what is really meant by "user specific" and "machine specific"?
Here's what I'm thinking: If LocalApplicationData
is machine specific, then I can use that as a basis for having my application save all of its data to a single common file for all users.
I'm also wondering about the ApplicationData
folder:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Should I instead use ApplicationData
to get what I want?
LocalApplicationData. 28. The directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.
You can either access it manually or by using the "AppData" variable name. You can view the AppData folder manually by going into your Users folder, which is there in the C drive. In my case, the path is C:\Users\ADMIN . Now you should be able to see the AppData folder in your User folder.
Environment. SpecialFolder. ApplicationData is the most common one. This folder holds per-user, non-temporary application-specific data, other than user documents. A common example would be a settings or configuration file.
where %CommonApplicationData% is the location of the application data folder shared by all users. The exact location depends on the operating system, however, under Windows 7 or later the common application data folder is usually C:\ProgramData.
Both ApplicationData
and LocalApplicationData
are only accessible to the currently logged-in user. The difference between these two is that ApplicationData
is replicated and synchronized to other devices which the user is using in an enterprise environment. It would be used to store a user's preferences.
As Raymond suggested (see docs), you're going to want to use a different folder. CommonDocuments
would be a good option for documents to be shared between all users. CommonMusic
if you're storing music and so on...
If you're wanting to store application-specific files use:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With