我们如何加密App.config的appSettings? [英] How can we encrypt the appSettings of App.config ?
本文介绍了我们如何加密App.config的appSettings?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在尝试使用以下代码对app.config文件的appsettings进行加密:
Hi All,
I am trying to encrypt appsettings of app.config file by using following code:
String path = AppDomain.CurrentDomain.BaseDirectory + "..\\..\\App.Config";
Configuration config = ConfigurationManager.OpenExeConfiguration(path);
ConfigurationSection appSettings = config.GetSection("appSettings");
appSettings.SectionInformation.ForceSave = true;
appSettings.SectionInformation.ProtectSection("ProtectedConfigurationSection");
config.Save();
我既没有收到任何错误,也没有对appsetting进行加密.现在,我该如何加密应用设置?
真的需要帮助!
问候!
Aman
Neither I m getting any error Nor appsetting are getting encrypted. Now, What Should I do to ENCRYPT appsettings?
Really need help!
Regards!
Aman
推荐答案
查看本文:
http://msdn.microsoft.com/en-us/library/ms254494.aspx [ ^ ]
向下滚动到标题为:
的部分
"使用受保护的配置加密配置文件节"
它是为ASP.NET引入的,但是您也可以在Winforms和WPF应用程序中使用它.
See this article:
http://msdn.microsoft.com/en-us/library/ms254494.aspx[^]
Scroll down to the section titled:
"Encrypting Configuration File Sections Using Protected Configuration"
It was introduced for ASP.NET, but you can use it from Winforms and WPF applications too.
看看本文
加密App.config的App.settings [
Take a look at this article
Encrypt App.settings of App.config[^]
这篇关于我们如何加密App.config的appSettings?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文