How to encrypt one entry in web.config

前端 未结 3 1808
半阙折子戏
半阙折子戏 2020-11-29 18:35

ASP.NET 4

I\'ve used RSA key encryption for connection strings in web.config on my web farm. However, there\'s one more custom password entry that I\'d like to encry

3条回答
  •  时光取名叫无心
    2020-11-29 19:06

    In c# and .Net 4.5 I had to use this to read the encrypted setting:

    string password = ((System.Collections.Specialized.NameValueCollection)ConfigurationManager.GetSection("secureAppSettings"))["Password"];
    

    but otherwise works a treat.

提交回复
热议问题