0

using the database first approach in Entity Framework, using the connection string stored in the app.config file, what would be the best approach in encrypting or hiding the connection string when deployed to production?

Paul
  • 1,291
  • 1
  • 8
  • 4
  • Possible duplicate of [Encrypt connection string in app.config](http://stackoverflow.com/questions/11637348/encrypt-connection-string-in-app-config) – stuartd Jun 29 '15 at 23:50
  • possible duplicate of [Encrypting Web.Config](http://stackoverflow.com/questions/1075245/encrypting-web-config) – SilverlightFox Jun 30 '15 at 09:27

1 Answers1

0

Define the location of config File

Configuration config  = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

if you want to encrypt connectionStrings

config.ConnectionStrings.SectionInformation.ProtectSection(Nothing);

you must be aware of app config portions

so if you want to encrypt AppSettings

config.AppSettings.SectionInformation.ProtectSection(Nothing);

enter image description here

Salem Ahmed
  • 1,067
  • 2
  • 12
  • 18