Error in Encrypting web.config connection string
Posted
by Mohan
on Stack Overflow
See other posts from Stack Overflow
or by Mohan
Published on 2010-03-12T07:19:36Z
Indexed on
2010/03/12
7:27 UTC
Read the original article
Hit count: 763
web.config
Hi everybody, I am encrypting web.config file. My code is below.
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
ConfigurationSection section = config.GetSection("connectionStrings");
if (!section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider");
config.Save();
}
but this gives me error
Object already exists. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Cryptography.CryptographicException: Object already exists.
© Stack Overflow or respective owner