title: C# - Error: Collection is read-only
body: <p>Im trying to creating a custom settings system for an administration and moderator panel that changes things like the site name, description, and so on. The method I'm using now is the NameValueCollection class that allows me to get the values of my defined keys within my Web.Config file to display in their proper places. My problem is, when it comes down to changing these values, I get <em>Collection is read-only.</em>.... Heres a small snippet of the ActionResult in using to update the values and the definitions listed in my config.</p>
  
  <pre><code>    Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
  
      NameValueCollection settings = new NameValueCollection();
      settings = (NameValueCollection)ConfigurationManager.GetSection("settings");
  
      settings.Set("siteName", SiteName);
      settings.Set("siteDesc", SiteDesc);
  
      return RedirectToAction("Index");
  
  &lt;section name="settings" type="System.Configuration.NameValueFileSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/&gt;
    &lt;settings&gt;
      &lt;add key="siteName" value="Gizmo" /&gt;
      &lt;add key="siteDesc" value="Welcome to a Gizmo Powered Website." /&gt;
    &lt;/settings&gt;
  </code></pre>
  
  <p>Once it goes to settings.Set(); thats where the error begins. Is there anyway I get around this? Like an alternative way of updating the keys and values in my Web.Config?</p>