There are settings I just want to change from the program, I don't want the file to be changed So I want to change the file path or try to hide it Is there a way?
Asked
Active
Viewed 332 times
1 Answers
0
Make them user scoped and then don't save the settings (or set them back to their defaults before you save the settings)
User Scoped settings are stored in a hidden file/folder under the user profile folder anyway. Only Application Scoped settings live in the YourAppName.config file alongside the EXE. Aplication Scoped settings cannot be changed at runtime
See also Why are application settings read-only in app.config?

Caius Jard
- 72,509
- 5
- 49
- 80
-
-
You can clear it before you save and restore it from code upon app launch!? – Caius Jard Apr 30 '20 at 17:53
-
Sorry I did not explain what I mean well, What I mean is I don't want the information in the user.config file or the saved information to be deleted, I just want the file not to open and see the saved information in it, that why i wanted to change the file path to another unknown path – DEVTE Apr 30 '20 at 18:27
-
That is no security at all. I can run Sysinternals Procmon and simply watch for when your program reads the new file, wherever it is, and get the path. At least when you put the info inside the exe it's marginally more protected – Caius Jard Apr 30 '20 at 23:40
-
You seem to know the values, and want to use them from Properties.Settings.Defaul as a way to use them through the whole app - so I'm saying "make them blank in the config file, set them to a value in your Form1.Load code or wherever, use them through the whole app, then blank them again just before you save the other updates preferences the user wants to keep. It then doesn't matter if the file is right under the user's nose- they'll have to decompile the exe to get the Settings. Which can be done by the way, so don't fool yourself that putting them in code is secure... – Caius Jard May 01 '20 at 05:27
-
It might be better to encrypt the config file: https://weblogs.asp.net/jongalloway/encrypting-passwords-in-a-net-app-config-file – Caius Jard May 01 '20 at 05:33
-
Actually I use ConfuserEx 1.3 as a code protection, + I also stop programs that try to access the program codes (I know it's not complete protection) I can also stop Sysinternals Procmon from working if someone runs my program there are a lot of ways , Thank you – DEVTE May 01 '20 at 19:53