
Originally Posted by
jmcilhinney
Follow the Protected Configuration link in my signature to see how to edit it at run time and encrypt it for security.
Do I need to import anything from your Protected Configuration project or do I follow the code in your FormEncrypt's Tools menu ?
Code:
'Open the primary config file.
Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
'Encrypt the connections strings section.
With config.ConnectionStrings.SectionInformation
.ProtectSection(Nothing)
.ForceSave = True
End With
'Save the changes.
config.Save(ConfigurationSaveMode.Full)