My program has a pretty extensive logging feature but the way I implemented it, the logging is stored in log files in the Program Files directory. But, I can not write to the log files unless the user runs the program as an administrator.
Is there a way to be granted access to a directory in the Program Files folder?
Another option I thought of was placing in the log files in the same location that the .config file is located. But, I'm not sure how to determine where that file is stored as it is usually stored under some ridiculous folder name like
The Program Files directory is purposely read-only to non admins for a reason. You could simply change permissions when your application is installed (when your code is run as an administrator) but that would likely allow any program to access the Program Files directory, a security violation!. I would suggest you write user-specific data to the user's directory, as recommended. See SpecialFolder.LocalApplicationData.