471,336 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Correct way of reading another application's configuration file

Hi, whats the correct way of opening up a different applications
configuration file?

i.e. i want to open someotherapp.exe.config and read the settings
contained in "applicationSettings".

Ive done the following code, but i dont if its the correct method
(doesnt take any form of security into account):

Configuration config = ConfigurationManager.OpenExeConfiguration(path);
ConfigurationSectionGroup configSectionGroup =
config.GetSectionGroup("applicationSettings");
Im using .NET 2.0.

Thanks
Jan 31 '06 #1
2 9712
Hello, Mark!

MI> i.e. i want to open someotherapp.exe.config and read the settings
MI> contained in "applicationSettings".

MI> Ive done the following code, but i dont if its the correct method
MI> (doesnt take any form of security into account):

MI> Configuration config = ConfigurationManager.OpenExeConfiguration(path);
MI> ConfigurationSectionGroup configSectionGroup =
MI> config.GetSectionGroup("applicationSettings");

MI> Im using .NET 2.0.

I'm no sure but ConfigurationManager can open file for exclusive read or write access. It is not good since original application may write smth to the config.

If you want to read some data from config file and that config is Xml, imo it will be more efficient to do it manually.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Jan 31 '06 #2
Hi,

The config file is in XML format, you can read it as any other XML file.

You have to make sure that it's not in use though.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi, whats the correct way of opening up a different applications
configuration file?

i.e. i want to open someotherapp.exe.config and read the settings
contained in "applicationSettings".

Ive done the following code, but i dont if its the correct method (doesnt
take any form of security into account):

Configuration config = ConfigurationManager.OpenExeConfiguration(path);
ConfigurationSectionGroup configSectionGroup =
config.GetSectionGroup("applicationSettings");
Im using .NET 2.0.

Thanks

Jan 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul Fi | last post: by
2 posts views Thread by Tony Jones | last post: by
reply views Thread by crackajaxx | last post: by
3 posts views Thread by Peter K | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.