There is an old Blog article :
What's the appropriate folder for an application's configuration files
I'm developing a C# Windows Form application in Visual Studio 2022 but probably besides the point. The tag dropdown confuses me. I digress...
Is there a more appropriate location to store application configuration information then under "program files" folder? Ideally I kind of like it in the program files folder but don't want to mess with "administrator privilege's" to run the program.
BACKSTORY: My application has an XML file it references containing settings. These settings are editable through a form that is launched via menu strip on the main application. Application runs perfectly if I launch it with administrator privilege's. Otherwise it crashes upon opening that form referencing the file. Pretty sure because I'm storing those configuration files in the applications root folder under "program files".
Developer technologies | Windows Forms
3 answers
Sort by: Most helpful
-
-
KOZ6.0 6,735 Reputation points
2025-09-23T00:19:00.5833333+00:00 You can use ApplicationData or CommonApplicationData.
// C:\Users\<UserName>\AppData\Roaming var userData = System.Environment.GetFolderPath( System.Environment.SpecialFolder.ApplicationData); // C:\ProgramData var commonData = System.Environment.GetFolderPath( System.Environment.SpecialFolder.CommonApplicationData); -
ALI AMIN 0 Reputation points
2025-09-24T17:57:38.0933333+00:00 This discussion about configuration file storage is really useful — especially the point about avoiding Program Files and instead using ApplicationData or CommonApplicationData. In a similar way, users in Pakistan benefit from digital tools that make daily tasks easier, like platforms where they can check electricity bills online without hassle. Thanks for sharing these best practices!