【问题标题】:What's the best approach in encrypting the entity framework connection string?加密实体框架连接字符串的最佳方法是什么?
【发布时间】:2015-09-16 14:25:41
【问题描述】:

在实体框架中使用数据库优先方法,使用存储在 app.config 文件中的连接字符串,在部署到生产环境时加密或隐藏连接字符串的最佳方法是什么?

【问题讨论】:

标签: entity-framework security encryption app-config


【解决方案1】:

定义config文件的位置

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

如果你想加密connectionStrings

config.ConnectionStrings.SectionInformation.ProtectSection(Nothing);

您必须了解应用配置部分

所以如果你想加密AppSettings

config.AppSettings.SectionInformation.ProtectSection(Nothing);

【讨论】:

    猜你喜欢
    • 2014-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 2017-09-22
    • 1970-01-01
    相关资源
    最近更新 更多