Where to keep config data other than config file (Windows App)?
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.
- I cannot use d开发者_高级运维atabase to store these configs.
- 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.)
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.
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
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
Encrypt the details to an XML file?
Use rijndael encryption that you can decrypt when you need it.
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.
精彩评论