Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created February 2, 2017 23:51
Show Gist options
  • Save gavilanch/05f1893cca696211c5ca122c37f1bf8d to your computer and use it in GitHub Desktop.
Save gavilanch/05f1893cca696211c5ca122c37f1bf8d to your computer and use it in GitHub Desktop.
Instrucciones para encriptar parte del appSettings
// En la clase
using System.Collections.Specialized;
using System.Configuration;
// En el método
var secureAppSettings = ConfigurationManager.GetSection("secureAppSettings") as NameValueCollection;
var Dato1 = secureAppSettings["Dato1"];
var Dato2 = secureAppSettings["Dato2"];
// En el web.config
<secureAppSettings>
<add key="Dato1" value="DatoSecreto1"/>
<add key="Dato2" value="DatoSecreto2"/>
</secureAppSettings>
// En ConfigSections
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment