tags:

views:

30

answers:

0

Hi everyone,

I am trying to encrypt sections of the application configuration file (app.exe.config) for security purposes. I succeeded in encryption the appSettings and connectionStrings. However, I get the following error when I try to encrypt the log4net part:

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for log4net: Could not load file or assembly 'log4net' or one of its dependencies. The system cannot find the file specified. (C:\Documents and Settings\My Documents\Visual Studio 2008\WebSites\Encryption\web.config line 33) ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net' or one of its dependencies. The system cannot find the file specified. at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError) at System.Configuration.MgmtConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) --- End of inner exception stack trace --- at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)

at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)

at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)

at System.Configuration.Configuration.GetSection(String sectionName) at Service.EncryptSection(String sectionName, String provider) in c:\Documents and Settings\SGhoora\My Documents\Visual Studio 2008\WebSites\Encryption\App_Code\Service.cs:line 55 at Service.Encrypt() in c:\Documents and Settings\SGhoora\My Documents\Visual Studio 2008\WebSites\Encryption\App_Code\Service.cs:line 25

I should be grateful if anyone can help on how to encrypt the log4net part. I have also used aspnet_regiss.exe. I got the same error. Can anyone help?