Home »

Why the Config File Might Not Be Writable

Question ListCategory: .NETWhy the Config File Might Not Be Writable
jamessmith05 author asked 1 year ago
1 Answers
milleranthony7 author answered 10 months ago

The configuration file is stored in the same directory as the executable itself. It’s pretty common for users not to have permission to write to this directory. Indeed that’s just common sense and good practice – ensuring that the user doesn’t have permission to write into directories where executables are stored prevents a lot of viruses, spyware, and other malware from wreaking havoc.
This is why the Program Files directory is configured not to allow normal users to write to it.Unfortunately, not everyone runs as a normal user – lots of people run as administrators on their Windows machines. This is a shame as it means they are throwing away a lot of the protection Windows can offer them. Of course one of the reasons so many people run as administrators is because of crappy applications that attempt to write into their installation directories.

Don’t make your application one of those crappy applications. Don’t try and write into the directory where your application is installed, because if you do that, your program won’t run properly unless the user is an administrator.

Of course there may be other reasons that the file isn’t writable. If your application is deployed via HTTP, the configuration file will live on the web server, and you are unlikely to be able to modify it.

Please login or Register to Submit Answer