By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,266 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,266 IT Pros & Developers. It's quick & easy.

strategy question regarding storing of configuration data

P: n/a
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 ...

Oct 4 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
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

"KarlM" <Ma******@newsgroup.nospamwrote in message
news:02**********************************@microsof t.com...
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 ...

Oct 4 '06 #2

P: n/a
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.
KarlM wrote:
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?
Oct 4 '06 #3

P: n/a
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

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

Oct 5 '06 #4

P: n/a
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/...9211304,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



"KarlM" wrote:
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 ...
Oct 5 '06 #5

P: n/a
"KarlM" <Ma******@newsgroup.nospamwrote in message
news:F5**********************************@microsof t.com...
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/...9211304,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.
>
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



"KarlM" wrote:
>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 ...

Oct 5 '06 #6

P: n/a
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.

"Glenn" wrote:
"KarlM" <Ma******@newsgroup.nospamwrote in message
news:F5**********************************@microsof t.com...
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/...9211304,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.

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



"KarlM" wrote:
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 ...


Oct 6 '06 #7

P: n/a
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/de...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.)

Oct 6 '06 #8

P: n/a
Karl

Here's where I started in .net 2.

http://msdn2.microsoft.com/en-us/lib...onmanager.aspx

From here you'll find all the documentation and examples you'll need. There
would seem to a lot to it, which there is, but actually its pretty simple to
use.

HTH

Glenn

"KarlM" <Ma******@newsgroup.nospamwrote in message
news:ED**********************************@microsof t.com...
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.

"Glenn" wrote:
>"KarlM" <Ma******@newsgroup.nospamwrote in message
news:F5**********************************@microso ft.com...
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/...9211304,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.
>
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



"KarlM" wrote:

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 ...



Oct 6 '06 #9

P: n/a
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.pap...07/132852.aspx
http://www.dotnet-guide.com/configur...ger-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.)

Oct 10 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.