Difference between 'SpecialFolder.LocalApplicationData' and 'SpecialFolder.ApplicationData'?

Tarion picture Tarion · Mar 14, 2012 · Viewed 30.3k times · Source

On my system, %AppData% leads to ApplicationData which is C:\Users\<USER>\AppData\Roaming

But there is also C:\Users\<USER>\AppData\Local
And for some more confusion D:\Users\<USER>\AppData\LocalLow

string local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

My question is, to which of these locations should my application save its data?

Are there guidelines for which of these locations to use? And am I leaving myself open to problems if I choose the wrong location?

Answer

Roger Lipscombe picture Roger Lipscombe · Mar 14, 2012

The Roaming folder is copied between machines when roaming profiles are enabled (in a domain environment). Use it for application data that you want to share between machines. But don't store large files in there -- IT departments don't like it when you do that, and it increases the time taken for the user to log in and to log out as the files are copied around.

The Local folder is not copied between machines. Use it for application data that's specific to a machine.

The LocalLow folder is used for low-privilege tasks (such as Internet Explorer). You shouldn't need to worry about it.

For files that the user specifically saved, you should put them (by default) in the Documents folder.