首页 > 网络编程 > ASP.NET > ASP.NET技巧 > 正文
asp.net 2.0中加密web.config
[日期:2006-1-28 0:00:00] [字体: ]

在asp.net 2.0中,可以很方便地加密web.config文件里的敏感信息了.比如如果有权限操作服务器的话,
可以用下面的方法加密web.config里的敏感信息,比如要加密数据库连接串
aspnet_regiis -pe "connectionStrings" -app "/应用程序的名字"

如果没权限的话,可以在程序里动态实现

Configuration config = Configuration.GetWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.Sections["connectionStrings"];
 section.ProtectSection ("DataProtectionConfigurationProvider");
 config.Update ();

上一篇:关于asp.net c#中对cookie的操作 下一篇:asp.net 2.0下嵌套masterpage页的可视化编辑
打印 】 【 关闭 】 【 阅读: 次 】
    相关文章