Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the Registry in .NET

Status
Not open for further replies.

DwaineC

MIS
Jan 6, 2003
40
US
I've been using the System Registry to store some user detail, for instance: Last accessed directory, and other application-specific information most likely boring to all of you. However, I just read in the latest XTRA.NET (by VB XTRA's) that it is advised to use config files instead. I particularly don't care which I use, but does anyone know why it is advised to NOT use the Registry in .NET? I have an international client that has numerous applications being converted to .NET and I need a good reason to tell them to use Config files... if, in fact, it is truly a .NET standard.

Thx...
 
It isn't a "bad" idea to put something in the registry, it's just discouraged. The reason being is that it makes the application less portable and requires an installation of some type instead of the preferred method of deployment which is XCOPY.

In addition, in certain environments (for example in our office we don't get access to registry with local user ID) the registry is locked from normal access and admin rights are required. It really depends on your situation, but as long as you understand the implications, you can try any of the approach.

If you want to use config files then there is a ConfigurationSettings class in the Configuration namespace but how much is it helpful is still needs to be determined. Because initially we tried using that and ended up writing our own class to write nodes to the config file because the above mentioned class allows you to read data from the config file and modify an existing node in a config file but if you want to create a new node, then that is really a tough thing to do. Following link will give you an idea of how to use this class


-Kris
 
Thank you very much for responding. In the current app, the registry is created, read from, and updated on the fly in the app, so it doesn't need a special installation. But, I do agree that we don't always know what the enduser's rights will be with regards to registry access or write privileges. Generally, this app will be used around the world on laptops in the jungles of Africa and other harsh conditions.

Even though this app may qualify as an exception, I want this company to implement .NET standards from the beginning and I think your comments bear merit. I will use them in our discussions, and I thank you again!

 
Kris11 is correct - the class in the framework will allow you to read from .config files, but not create or update them (a serious shortcoming, IMO).

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top