6
我用我的aspx加载中的代码加密web.config中的连接字符串。解密web.config中的connectionString?
protected void Page_Load(object sender, EventArgs e)
{
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringsSection connSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
connSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
config.Save();
}
我是c#的新手,现在我需要的是解密。任何想法如何?
我只能使用下面的代码解密一行。
protected void Page_Load(object sender, EventArgs e)
{
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringsSection connSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
//connSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
connSection.SectionInformation.UnprotectSection();
config.Save();
}
谢谢。
这是否帮助? http://msdn.microsoft.com/en-us/library/dtkwfdky(v=vs.100).aspx –
谢谢!!它帮助我! – user3357141