Created
February 2, 2017 23:51
-
-
Save gavilanch/05f1893cca696211c5ca122c37f1bf8d to your computer and use it in GitHub Desktop.
Instrucciones para encriptar parte del appSettings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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