Thank you Joe Joe-3, that worked out perfectly for me. I really appreciate
the advice/help. For those who may come across this in the future, here's
what my code/config looks like.

*Web.config*
<log4net>
    <root>
      <level value="All" />
      <appender-ref ref="AdoNetAppender" />
    </root>

    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
      <bufferSize value="1" />
      <connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
      <connectionStringName value="Log4Net"/>
    ..........
</log4net>

<connectionStrings>
    <add name="Log4Net" connectionString="data source=ServerName;initial
catalog=DatabaseName;User Id=UserID;Password=Somepassword"
      providerName="System.Data.EntityClient" />
</connectionStrings>


*Encryption Method in Code Behind*
Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");
ConfigurationSection section = config.GetSection("connectionStrings");
if (!section.SectionInformation.IsProtected)
{
      
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
       config.Save();
}

I call the encryption method at startup of my website. It will encrypt the
connectionStrings section of the file at rest and leave it encrypted forever
unless you decrypt it. If anyone has any questions in the future feel free
to reach out. 

Once again thank you for the advice Joe,
UDN



--
View this message in context: 
http://apache-logging.6191.n7.nabble.com/Encrypt-connection-string-in-Log4Net-configuration-tp61227p61259.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to