strategy question regarding storing of configuration data

G

Guest

After reading some articles regarding confuguration data I'm a bit confused.

Where is the right place for storing configuration data?
- XML-files?
- registry?
- INI-files? (from a users point of view, ini-files are more comfortable to
read and edit)

Where should I store user specific config data?
Where should I store machine specific config data?

Why not use the registry? There are some articles, that mention, that the
registry should not be used any more. Why not? How can I implement Group
Policy without using the regisry?


The standard mechanism of C# / Net-Framework creates a file named
»Application.exe.config« in the program directory.
Is the program directory the right place for configuration information?
Due to windows design guidelines files in the program directory should not
be edited. From this point of view, the program directory seems not to be a
good place for config information.

It would be helpfull to get some comments to this questions.
Thanks in advance

Regards ...
 
G

Glenn

Personally, I use .config files. It's easy to encrypt down to the section
level, you can extend them by creating your own config sections and the
framework provides all the classes you'll need to cleanly access and update
them.

HTH

Glenn
 
J

james.curran

Unfortunately, there's no really good answer, just the one that, in
your particular circumstance, is better than the rest.

Some things to consider when trying to decide whcih that is:
- If XML or the registry scare your users, they probably shouldn't be
editting a configuration file manually anyway.
- In a properly locked-down system, the C:\Program Files tree should be
writable only to administrators. Hence, the application.exe.config
should probably only be used for items that are set at installation and
never changed.
-Small amounts of user-specific data should probably go in the
HKEY_Current_User section of the register.
- Large amounts of user-specific data should probably go the isolated
storage (C:\Documents and Settings\user\Local Settings\Application
Data)
-Small amounts of machine -specific data should probably go in the
HKEY_LOCAL_MACHINE section of the register.
-I have no idea where large amounts of machine-specific data should go.
 
K

Kevin Yu [MSFT]

Hi Martin,

Actually, you can use any other these 3 ways to store the configuration
data. But for a .NET app, we suggest you use the app.config file.

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Thanks to anybody for comments!

OK, it seems to be »state of the art« to use XML-Files for configuration data.
But there are really a few questions left:

1.
There are many needs to change application specific data after installation.
For sure, only the system administrator should do this.
Should the config-file better be saved in »common application data« instead
of the ProgDir-Folder?
Is there a way to do this using the net standard features (I could not find
a solution to change the folder (or name) of the application.exe.config).

2.
As far as I know, the application.exe.config cannot be changed during runtime.
So, it seems to me, that I have to implement a second Configuration file,
that can be changed by the administrator at runtime of the app. Correct?

So, it seems to me, that the application.exe.config is basicly a config-file
for the developer, but not for the administrator of the system.

I found a statement at:
http://www.builderau.com.au/program...uration_settings/0,339028469,339211304,00.htm

This solution seems to be more flexible.

I am looking forward to further comments, just to make sure, that I
understood the basic concept of the net-config-mechanism.

Thanks.

Regards
Karl.











After reade
 
G

Glenn

KarlM said:
Thanks to anybody for comments!

OK, it seems to be »state of the art« to use XML-Files for configuration
data.
But there are really a few questions left:

1.
There are many needs to change application specific data after
installation.
For sure, only the system administrator should do this.
Should the config-file better be saved in »common application data«
instead
of the ProgDir-Folder?
Is there a way to do this using the net standard features (I could not
find
a solution to change the folder (or name) of the application.exe.config).

You can encrypt sections of the file to prevent user tampering.
2.
As far as I know, the application.exe.config cannot be changed during
runtime.
So, it seems to me, that I have to implement a second Configuration file,
that can be changed by the administrator at runtime of the app. Correct?

It definately can be changed at runtime.
So, it seems to me, that the application.exe.config is basicly a
config-file
for the developer, but not for the administrator of the system.

Can't agree with you there. I personally believe it makes a developers
lives easier, but our guys in the Support team like them as well given the
farting around that have to do with some non-.NET apps we have around.

What about web applications? Web.config makes administration pretty easy.
I found a statement at:
http://www.builderau.com.au/program...uration_settings/0,339028469,339211304,00.htm

This solution seems to be more flexible.

If you want to, sure, but you can extend config files by creating your own
configuration section classes which are type-safe and can be secured with
relative ease. You also don't have to mess around with type serialisation,
ok, yes, it's relatively easy, but why bother when it's all there in
System.Configuration.

It just feels like your re-inventing the wheel.
 
G

Guest

Hi Glenn,

thanks for your comments. I think you are right.

So I am going to look a bit deeper into the System.configuration classes and
try to use them.
If you have some documentation / links / sample available about the using of
these classes, that would be great.

Thanks for your help.
Regards
Karl.
 
K

Kevin Yu [MSFT]

Hi Karl,

If you need some configurations to be changed, you can take a look at the
Setting files. Here is a technical article.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html
/SettingsCS_RL.asp

I think it will meet your requirements. Let me know if you have any concern
on it.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Glenn is right. MSDN document has given us very good sample of how to use
ConfigurationManager class. You can also find some more samples on other
sites. Here are some of them.

http://codebetter.com/blogs/john.papa/archive/2005/10/07/132852.aspx
http://www.dotnet-guide.com/configurationmanager-class.html

If anything is unclear, please feel free to let me know.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top