views:

59

answers:

5

My Windows application GUI is accepting some required application configuration fields from the user. I need to store them of course, but I wanna hide these fields from the user.

  1. I cannot use database to store these configs.
  2. I want to avoid using app.config either. (No app.config encryption)

Any suggestions, Where and in which format i should store fields. (Field example is: Accepting database User credentials, Task Schedule info etc.)

A: 

You can always write your own XML file and use the .NET cryptography classes to encrypt the data.

http://msdn.microsoft.com/en-us/library/ms229749.aspx

Chris Taylor
A: 

Encrypt the details to an XML file?

Use rijndael encryption that you can decrypt when you need it.

Andre
A: 

It's called The Windows Registry. I hate to recommend the use of it, but I think that it fits your requirement and its use quite ubiquitous.

Adam Crossland
+1  A: 

These are possible: (but crazy and bad ideas): 1. Registry 2. Create your own custom settings file 3. Encrypt them 4. Write a web service api and store them on a web server

Andrew Lewis
No webserver...... Its windows app.
Novice
A: 

I would use an XML file (encrypt if you feel its necessary) and use

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

to store it in the %AppData% section of the user's file system.

Additionally, you may write a Settings class which you serialize to disk and deserialize to memory -- this could save you some persistance logic with the XML namespace.

Nate Bross
I will install this app as System Administrator on the machine, but usually user will work on the system with his User Account (not as Admin). Do you think if there gonna be any problem, if i use %AppData% to store info?
Novice
No, that is exactly the point of AppData -- it will find a place the current user has read/write access to.
Nate Bross