Skip to content

Instantly share code, notes, and snippets.

@caevyn
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caevyn/8909279 to your computer and use it in GitHub Desktop.
Save caevyn/8909279 to your computer and use it in GitHub Desktop.
Separate encrypted app settings section
var section = (NameValueCollection)ConfigurationManager.GetSection("secureAppSettings");
var key = section["encryptMe"];
<configuration>
<configSections>
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<secureAppSettings>
<add key="encryptMe" value="ImSuperSecret" />
</secureAppSettings>
</configuration>
@caevyn
Copy link
Author

caevyn commented Feb 10, 2014

Then run aspnet_regiis to encrypt that section. http://msdn.microsoft.com/en-us/library/k6h9cz8h(v=vs.80).aspx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment