Encrypt Connection String

Hi there, so I am looking to try and encrypt my connection string in the app.config OR hard coding would be sufficient. I have no idea how to do this.

I have done quite a bit of research and there have been code snippets given like :

Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLev el.None) Dim configSection As ConfigurationSection configSection = config.ConnectionStrings If Not (configSection Is Nothing) Then If Not (configSection.ElementInformation.IsLocked) Then configSection.SectionInformation.ProtectSection(“DataProtectionConfigurationProvider”) configSection.SectionInformation.ForceSave = True config.Save(ConfigurationSaveMode.Full) End If End If

What I need to know is where to put his kind of code, ive tried putting on form_load but it does not work?>

submitted by /u/kmankx2
[link] [comments]

Leave a Reply