0

C# Windows Desktop Application

.Net 4.5

What is a best practice for get a programmer/admin/deployment ability to change settings.xml file BUT hide/prevent changing this file by a user?

Condition: settings.xml is in the same folder as .exe file

I did a search at the forum. But what is the simplest solution?

Any help would be appreciate.

student71
  • 11
  • 3
  • If did understand your question, you'd want to set up a database for user accounts in your application. You can't stop people from editing a local file but you can encrypt it for instance and make it so that only users with an admin role could access it. – Ahmed Aboumalek Apr 07 '16 at 23:11
  • Thank you Angelo, So, as a programmer/deployment package I would not have an admin role. – student71 Apr 07 '16 at 23:49
  • To be clear, an admin role is simply a type of user that you will manually assign to yourself or anyone else who should access the file. For example, you have your `user` class with a `type` property. By default the constructor will assign `type`, the attribute `regular`. But you can make an interface for instance to change an account type to `admin`. Otherwise, you can always try to create a readOnly file, or even make it hidden. However, there might be ways to bypass it. So it's not entirely secure. http://stackoverflow.com/questions/11777924/how-to-make-a-read-only-file – Ahmed Aboumalek Apr 08 '16 at 08:32

0 Answers0