Encrypt web.Config sections using c# in asp.net
To give secuity to to your web application you need to make your applications secured you can encrypt the certain sections of web.config . To accomplish this task microsoft has provided library in the namespace System.Web.Configuration . To Encrypt the web.config section you can use the following code using System.Configuration.Provider; using System.Configuration.Assemblies; using System.Web.Configuration; Configuration confi = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection section = confi.ConnectionStrings; section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider"); To Decrypt the web.config section you can use the following code using System.Configuration.Provider; using System.Configuration.Assemblies; using System.Web.Configuration; Configuration confi = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection section = confi.ConnectionStrings; section.Sec