using encryption witg RSA programmaticaly:
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/");
System.Configuration.ConfigurationSection appSetting = config.GetSection("connectionStrings");
if (appSetting.SectionInformation.IsProtected)
{
appSetting.SectionInformation.UnprotectSection();
Label1.Text = " ConnectionString is decrypted";
}
else
{
appSetting.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
Label1.Text = " ConnectionString is encrypted";
}
config.Save();