title: Encrypting custom sections of a web.config
body: <p>I used the article <a href="http://www.15seconds.com/issue/040504.htm" rel="noreferrer">Creating a Flexible Configuration Section Handler</a> to create a Flexible Configuration Section Handler in my application.</p>
  
  <p>I also saw this article entitled <a href="http://odetocode.com/blogs/scott/archive/2006/01/08/encrypting-custom-configuration-sections.aspx" rel="noreferrer">Encrypting Custom Configuration Sections on the OdeToCode blog</a>, on how to encrypt portions of a web.config file.</p>
  
  <p>From the first article, we have this web.config code.</p>
  
  <pre><code>&lt;?xmlversion="1.0"encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;sectionname="StyleSheetSettings_1"    
              type="FifteenSeconds.Core.BasicConfigurator"/&gt;
      &lt;/configSections&gt;
      &lt;StyleSheetSettings_1&gt;
          &lt;StyleSheets&gt;
              &lt;Style SheetName="Page"Href="Styles/Page.css"Media="screen"/&gt;
              &lt;StyleSheetName="Custom"Href="Styles/Custom.css"Media="screen"/&gt;
              &lt;StyleSheetName="Print"Href="/Lib/Styles/Print.css"Media="print"/&gt;
          &lt;/StyleSheets&gt;      
      &lt;/StyleSheetSettings_1&gt;
   &lt;/configuration&gt;
  </code></pre>
  
  <p>I tried to use the following code to encrypt the code using something like the following command line code.</p>
  
  <pre><code> aspnet_regiis.exe -pef  "StyleSheetSettings_1" C:\Test\
  </code></pre>
  
  <p>I am getting the following error </p>
  
  <blockquote>
    <p>Could not load type
    FifteenSeconds.Core.BasicConfigurator'
    from assembly 'System.Web,
    Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a'.</p>
  </blockquote>
  
  <p>Any help would be appreciated.</p>