Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

App.Config not encrypting... Windows Form

$
0
0
Hello,

I am trying to encrypt the app.config file on my project. I am using this code :


HTML Code:



' Open the app.config file. 

  Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) 

03 

04      ' Get the section in the file. 

05    Dim section As ConfigurationSection = config.GetSection(nameOfSection) 

06 

07      ' If the section exists and the section is not readonly, then   

08      ' protect the section. 

09      If section IsNot Nothing Then

10          If Not section.IsReadOnly() Then

11              ' Protect the section. 

12              'DataProtectionConfigurationProvider   

13              'RsaProtectedConfigurationProvider 

14              section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider") 

15              section.SectionInformation.ForceSave = True

16 

17              ' Save the change. 

18              config.Save(ConfigurationSaveMode.Modified) 

19          End If

20      End If



I have used both RSA and Dataprotectionprovider and neither one encrypts the data. There aren't any errors specifically that I am concerned about but it just doesn't encrypt the file. Any ideas?

Found out it encrypts one of the app.config's on the computer in the appdata/2.0/... folderpath but not the other. Any ideas? Both files are named... ApplicationName.exe.config but only one gets encrypted and I am not sure why.


So the idea is that no one should be able to open the configuration files in something like notepad and see the connection strings. All I ha e done is publish the application nothing fancy. When I go to when the. Exe and configuration files are saved once installed there are two. All I am doing is opening them both in notepad. One is encrypted the other is not. Neither one is set as like a resource or extra file in my project so I am not sure. You would think with only one configuration in Dev would mean only one in production. Any ideas?

They are two separate directories with the same filename. It happens when I use clickonce to deploy the application. When I do the install it creates the folders in the appdata/Apps/2.0 directory with weird letters/numbers for folder names and a subdirectory under that

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>