Hi,
I am trying to encrypt the connection string that is stored in web.config file by programming. However, i am not being able to do that. Below is my code:-
using System.Web.Configuration;
using System.Web.Security;
using System.Configuration;
public void EncryptConnString()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("connectionStrings");
if (!section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
config.Save();
}
}
Please suggest me some measures and if i am wrong correct me...
Thanks and Regards
Akiii