title: How to edit the ApplicationSettings section of app.config in WPF application
body: <p>I have been researching this issue for long. But I haven't come across any satisfying solution. </p>
  
  <p>The scenario is that I have a WPF client application. I have a couple of web references added to the project and I Settings.Designer.cs file was modified and had a hard coded reference to the srever url and port. This started getting reflected in my app.config file in ApplicationSettings section. </p>
  
  <p>Before the user logs in, he can specify the settings for the ServerIP and Port for the server. Now I would like to save these settings in app.config and get the value for server IP and port picked up from there or save it elsewhere and connect to the server through this IP and Port. I would like these changes to persist.</p>
  
  <p>One solution that I could think of was to read the app.config through an XML reader, modify the file, save it and restart the application somehow. </p>
  
  <p>I am not able to think of a better scenario as I think ApplicationSettings section can not be modified from inside the application.</p>
  
  <p>EDIT:</p>
  
  <p>My applicationSettiings section looks something like this:</p>
  
  <pre><code>&lt;applicationSettings&gt;
  &lt;ApplicationName.Properties.Settings&gt;
    &lt;setting name="Web_Service_Reference_Name1" serializeAs="String"&gt;
      &lt;value&gt;http://10.1.100.118:8080/AD/WebService1&lt;/value&gt;
    &lt;/setting&gt;
    &lt;setting name="Web_Service_Reference_Name2" serializeAs="String"&gt;
      &lt;value&gt;http://10.1.100.118:8080/AD/WebService2&lt;/value&gt;
    &lt;/setting&gt;
  &lt;/ApplicationName.Properties.Settings&gt;
  &lt;/applicationSettings&gt;
  </code></pre>