title: missing a section declaration
body: <p>I've done the following in the Web.config</p>
  
  <pre><code>    &lt;configuration&gt;
    &lt;configSections&gt; 
      &lt;section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral  PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" allowLocation="true" /&gt;
      &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
        &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    ... etc
  </code></pre>
  
  <p>And then in the Views/Web.config I've tried to use it like this</p>
  
  <pre><code>    &lt;secureAppSettings&gt;
      &lt;!--Captcha keys--&gt;
      &lt;add key="RecaptchaPrivateKey" value="somevalue" /&gt;
      &lt;add key="RecaptchaPublicKey" value="someothervalue" /&gt;
  
    &lt;/secureAppSettings&gt;
  </code></pre>
  
  <p>however every time try to open the site I get the following error:</p>
  
  <blockquote>
    <p>Config Error    The configuration section 'secureAppSettings' cannot
    be read because it is missing a section declaration</p>
  </blockquote>
  
  <p>and I don't understand what I'm supposed to do. I'm currently trying to use it in the view like this:</p>
  
  <pre><code>@((NameValueCollection)WebConfigurationManager.GetSection("secureAppSettings"))["RecaptchaPublicKey"]
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I've tried as one of the comments suggest to move the configSections to the View/web.config</p>
  
  <p>the result is the following Error message</p>
  
  <blockquote>
    <p>Parser Error Message: An error occurred while creating the handler for the secureAppSettings configuration section: The specified assembly name or specified codebase was invalid. (Exception from HRESULT: 0x80131047)</p>
  </blockquote>
  
  <p>I took that as a sign that I was doing it wrong but I see now that maybe I need to fix something here instead of doing it the other way I was doing. </p>
  
  <p>however the message for me is as cryptic as before..</p>
  
  <p><strong>Clarification of what I'm trying to archive.</strong></p>
  
  <p>I've got some sensitive information in my Web.config that I would like to encrypt.
  I read that I could make a secureAppSettings section and then encrypt it from there. the reason I want to separate the information out of the appSettings section is because I've got plenty of other information in it that I really do not need encrypted. 
  eventually all of this should lead to that I'm able to make a MSI website installer where, during the installation, I can change or add settings to the appSettings and the secureAppSettings sections before encrypting the secureAppSettings. for easy setup and installation of the site I'm building.</p>
  
  <p>Now I'm not sure if the way my solution is currently, is going to work, but if not, then I'd like to be pointed in the right direction, to solve my ultimate goal, of being able to make a MSI installer, where I can change the configuration file, during the installation and encrypt any sensitive information. </p>