title: How to extract connection string from another application's app.config / web.config file in C#
body: <p>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.</p>
  
  <p>I have read plenty of examples of how to use <code>ConfigurationManager.OpenExeConfiguration</code> 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.</p>
  
  <p>One way to go is to use <code>XDocument.Load</code> 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.</p>
  
  <p>Is there a way I can take advantage of some part of <code>ConfigurationManager</code> to do this?</p>
  
  <p>Both <code>System.Configuration</code> and <code>System.Xml.Linq</code> are large, and I'm starting from zero - so any hints on how to accomplish this with minimum fuss would be appreciated.</p>