点击进入远洋地带社区

字体:  

asp.net 2.0中加密web.config

cao2571 发表于: 2007-10-03 13:25 来源: 远洋门户


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 ();