title: Modify configuration section programmatically in medium trust
body: <p>I have a custom ConfigurationSection in my application:</p>
  
  <pre><code>public class SettingsSection : ConfigurationSection
  {
      [ConfigurationProperty("Setting")]
      public MyElement Setting
      {
          get
          {
              return (MyElement)this["Setting"];
          }
          set { this["Setting"] = value; }
      }
  }
  
  public class MyElement : ConfigurationElement
  {
      public override bool IsReadOnly()
      {
          return false;
      }
  
      [ConfigurationProperty("Server")]
      public string Server
      {
          get { return (string)this["Server"]; }
          set { this["Server"] = value; }
      }
  }
  </code></pre>
  
  <p>In my web.config</p>
  
  <pre><code>  &lt;configSections&gt;
      &lt;sectionGroup name="mySettingsGroup"&gt;
        &lt;section name="Setting" 
                 type="MyWebApp.SettingsSection"  
                 requirePermission="false" 
                 restartOnExternalChanges="true"
                 allowDefinition="Everywhere"  /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  
    &lt;mySettingsGroup&gt;
      &lt;Setting&gt;
        &lt;MyElement Server="serverName" /&gt;
      &lt;/Setting&gt;
    &lt;/mySettingsGroup&gt;
  </code></pre>
  
  <p>Reading the section works fine. The issue I'm having is that when I read the section via</p>
  
  <pre><code>var settings = (SettingsSection)WebConfigurationManager.GetSection("mySettingsGroup/Setting");
  </code></pre>
  
  <p>And then I proceed to modify the <code>Server</code> property:</p>
  
  <pre><code>   settings.Server = "something";
  </code></pre>
  
  <p>This doesn't modify the "Server" property in the web.config file.</p>
  
  <p>Note: This needs to work under medium-trust, so I can't use <code>WebConfigurationManager.OpenWebConfiguration</code> which works fine. Is there an explicit way to tell the <code>ConfigSection</code> to save itself?</p>