title: Configuring ELMAH with SQL Server logging with encrypted connection string
body: <p>I'm attempting to configure ELMAH error logging in an ASP.NET 4 application using SQL Server 2008 R2. Is there any way I can tell ELMAH to call our in-house decryption function on the connection string we provide it? Do I need to modify the ELMAH source and rebuild?</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configSections&gt;
    &lt;sectionGroup name="elmah"&gt;
      &lt;section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" /&gt;
      &lt;section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" /&gt;
      &lt;section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" /&gt;
      &lt;section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" /&gt;
    &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  
  &lt;elmah&gt;
    &lt;security allowRemoteAccess="1" /&gt;
    &lt;errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ELMAH" /&gt;
  &lt;/elmah&gt;
  
  &lt;connectionStrings&gt;
    &lt;add name="ELMAH" connectionString="EncryptedConnectionString" providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  
  &lt;system.webServer&gt;
    &lt;handlers&gt;
      &lt;add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" /&gt;
    &lt;/handlers&gt;
    &lt;modules&gt;
      &lt;add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" /&gt;
    &lt;/modules&gt;
  &lt;/system.webServer&gt;
  </code></pre>