How to encrypt Connectionstring written in web.config from codebehind?


I need to encrypt connectionstring and some appsettings keys value in web.config from code behind.

Please help.


Check these url - use aspnet_regiis.exe <a href="http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx</a>

<a href="http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.protectsection.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.protectsection.aspx</a>


try this

private void ProtectSection(string sectionName, string provider) { Configuration config = WebConfigurationManager. OpenWebConfiguration(Request.ApplicationPath); ConfigurationSection section = config.GetSection(sectionName); if (section != null && !section.SectionInformation.IsProtected) { section.SectionInformation.ProtectSection(provider); config.Save(); } }


  • Create my own classList object when the browser does not implement it itself
  • Zero downtime deployment Nodejs application
  • Does anyone know about Kephas?
  • Google Cloud dataflow : Read from a file with dynamic filename
  • Streaming huge json with Akka Stream
  • Salesforce consuming XML and display data in Visualforce report
  • PHP Append to Excel file
  • “RepeatForUnit” item missing in Calendar entry?
  • NHibernate add unmapped column in interceptor
  • Spring Cloud Config - Multiple Composite Repositories?
  • Identifying dates in strings using NLTK
  • How to resolve authentication error in npm install?
  • Python Equivalent of Java's 'Keystore'?
  • How to escape xpath in php
  • javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice
  • Jenkins sending notifications to the wrong commit id
  • yii rewrite url with many sub categories
  • Why am I getting an Argument exception when creating event handler dynamically?
  • How to close a WebView with double-click?
  • Loading hyperspectral images in Octave
  • How to get a time and Date Separately?
  • Example of using Service Exists MSBuild task in Microsoft.Sdc.Tasks?
  • Load php page results into div with ajax with link?
  • Auto send email based on the time and email address in database
  • Sample deviceQuery cuda program
  • Admob in ListView not clickable
  • Set initial vuetify v-select value
  • playing mp3 from nsbundle
  • Arraylist of strings into one comma separated string
  • Stop an element moving with padding on hover
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • How to create subsets of a single set of elements with XSLT?
  • using maven pom while creating jar:test-jar some times it says JAR will be empty - no content was ma
  • Neo4j…how to get a visual representation of my data?
  • Python 3x- Compression Makes File Bigger :(
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • Running R's aov() mixed effects model from Python using rpy2