Posts

You can face a problem with your connection strings or other confidential and critical information is stored in configuration file when hosting web site or distributing application to clients. You have many solution options in this case like using SSO, SSS, store encrypted data in a database. But these methods are time consuming and sometime expensive. The solution I can offer is to encrypt data in configuration file using System.Configuration library from .NET Add reference to System.Configuration to your project and run this code once// Get the current configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);// Get the section. ConfigurationSection section = config.GetSection("connectionStrings"); // Protect (encrypt)the section. section.SectionInformation.ProtectSection( "RsaProtectedConfigura…