2015-06-29 40 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

相关问题