473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ex e.config and read the settings
contained in "applicationSet tings".

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

Configuration config = ConfigurationMa nager.OpenExeCo nfiguration(pat h);
ConfigurationSe ctionGroup configSectionGr oup =
config.GetSecti onGroup("applic ationSettings") ;
Im using .NET 2.0.

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

MI> i.e. i want to open someotherapp.ex e.config and read the settings
MI> contained in "applicationSet tings".

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 = ConfigurationMa nager.OpenExeCo nfiguration(pat h);
MI> ConfigurationSe ctionGroup configSectionGr oup =
MI> config.GetSecti onGroup("applic ationSettings") ;

MI> Im using .NET 2.0.

I'm no sure but ConfigurationMa nager 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******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi, whats the correct way of opening up a different applications
configuration file?

i.e. i want to open someotherapp.ex e.config and read the settings
contained in "applicationSet tings".

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

Configuration config = ConfigurationMa nager.OpenExeCo nfiguration(pat h);
ConfigurationSe ctionGroup configSectionGr oup =
config.GetSecti onGroup("applic ationSettings") ;
Im using .NET 2.0.

Thanks

Jan 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4741
by: Amy L. | last post by:
I have a basic console application that uses a app.exe.config file for all the application settings. The application through several revisions now has over 100 options that are set in the app.exe.config file. We decided to create a Windows Application that will configure this file. Is there any easy way to have have this configuration application read the other applications app.exe.config file so that the values can be accessed through...
1
2859
by: Paul Fi | last post by:
I have this problem with .NET remoting: my remote class is called RemoteHandler which implements an interface called IEazyRemoting which has only one method to be implemented which is my server configuration file looks like this: <configuration> <system.runtime.remoting> <application> <service>
2
2748
by: Tony Jones | last post by:
Is it possible for me to create a class library DLL and have it read it's configuration settings from the web.config of the ASP.NET application referencing it? IE - if I call ConfigurationSettings.GetConfig("somesection") in one of the base class dll methods, will it/can it return the settings from the web.config? For example, I would like to create a base class library of utility classes that can be used with any ASP.NET application....
10
9473
by: Ryan | last post by:
I've created a custom configuration section that inherits (naturally) from System.Configuration.ConfigurationSection. The configuration section is working 99% fine, however I keep coming across a ConfigurationErrorException whenever I do the following: 1. Modify and save the section in code using the System.Configuration.Configuration.Save(). 2. Refresh teh section using ConfigurationManager.RefreshSection 3. Encrypt the section,...
0
1316
by: crackajaxx | last post by:
I've hunted for a while so I'm hoping someone can shed some light on this problem for me. I have an application (not a web-app, in fact this is an installed service) that relies upon its application configuration file to provide it with sensitive information. In this case, the application is talking to a website that requires credentials that are not the same as the user that the application runs as (again, its installed as a service).
0
4007
by: tmsprowl | last post by:
Greetings! I was wondering if someone could help me with a problem I'm having. My department is just one of many within my organization. My organization has control over the network domain, but my department has a couple of web servers of our own that are part of my organization's domain. I am trying to read LDAP information on my organization's domain controller from a web application on one of my department's servers. I have been...
0
8189
by: Lucky | last post by:
Hi guys, I've got a problem under reading settlings from App.config file. I've used System.Configuration to reach to the "User Settings" and "Application Settings" sections. the problem is now I'm not able read the property defined under this section. those are like this User Settings -Testing Application Settings -Test
3
3866
by: Peter K | last post by:
Hi I need to be able to supply some relatively complex configuration to an application. The application will either run in a web context (with a web.config file, or as a application with an app.config). The only configuration reading I have used before is AppSettings and I have also used Spring Framework. It is more the type of configuration that Spring uses I am looking at now.
1
2594
by: MasterLalit | last post by:
Hi, i am using a app.config file in my console application. App.config code--> <configuration> <configSections> <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </configSections> <enterpriseLibrary.ConfigurationSource...
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.