在asp.net 2.0中,可以很方便地加密web.config文件里的敏感信息了.比如如果有權(quán)限操作服務(wù)器的話,
可以用下面的方法加密web.config里的敏感信息,比如要加密數(shù)據(jù)庫(kù)連接串
aspnet_regiis -pe "connectionStrings" -app "/應(yīng)用程序的名字"
如果沒權(quán)限的話,可以在程序里動(dòng)態(tài)實(shí)現(xiàn)
Configuration config = Configuration.GetWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.Sections["connectionStrings"];
section.ProtectSection ("DataProtectionConfigurationProvider");
config.Update ();