0
無法理解爲什麼這個工作原理在web(改用WebConfigManager)而不是winapp.When我看看配置文件仍然沒有加密!我錯過了什麼? 你能幫忙嗎?無法加密winforms中的連接字符串,但在web中工作嗎?mmm你能幫忙
EncryptionUtility.ProtectSection("connectionStrings", "DataProtectionConfigurationProvider");
public class EncryptionUtility
{
public static void ProtectSection(string sectionName,string provider)
{
var config = ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.ExecutablePath);
var section = config.GetSection(sectionName);
if (section == null || section.SectionInformation.IsProtected) return;
section.SectionInformation.ProtectSection(provider);
config.Save();
}
public static void UnProtectSection(string sectionName)
{
var config = ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.ExecutablePath);
var section = config.GetSection(sectionName);
if (section == null || !section.SectionInformation.IsProtected) return;
section.SectionInformation.UnprotectSection();
config.Save();
}
}
愚蠢的問題我怎麼知道我正在加密哪一個? – 2009-12-03 21:00:57
一個臨近執行的exe文件,名爲 –
2009-12-03 21:07:01