2015-06-29 81 views
0

在Entity Framework中使用數據庫第一種方法,使用存儲在app.config文件中的連接字符串,在部署到生產時加密或隱藏連接字符串的最佳方法是什麼?加密實體框架連接字符串的最佳方法是什麼?

+0

[在app.config中加密的連接字符串](http://stackoverflow.com/questions/11637348/encrypt-connection-string-in-app-config)的 – stuartd

+0

可能重複的可能的複製[加密Web.Config中](http://stackoverflow.com/questions/1075245/encrypting-web-config) – SilverlightFox

回答

0

如果要加密connectionStrings

config.ConnectionStrings.SectionInformation.ProtectSection(Nothing); 

如果要加密AppSettings

你必須瞭解應用程序配置部分

這樣的定義config文件

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

的位置

config.AppSettings.SectionInformation.ProtectSection(Nothing); 

enter image description here

相關問題