I am writing a command line utility which will sit in a web applications's bin folder, and needs to read the connection string of that web application, in order to perform some maintenance tasks on that database.
I have read plenty of examples of how to use ConfigurationManager.OpenExeConfiguration
to read settings from the current application's config file. But this doesn't appear to apply in my case, as I need to read another application's config file.
One way to go is to use XDocument.Load
which will read the xml file and allow me to manipulate it using LinqToXml. If I have to learn this method I will do, but it will take a little tinkering time to get right.
Is there a way I can take advantage of some part of ConfigurationManager
to do this?
Both System.Configuration
and System.Xml.Linq
are large, and I'm starting from zero - so any hints on how to accomplish this with minimum fuss would be appreciated.