Codigos Fonte, Artigos e Dicas
Criptografar Connection String (App.Confing / Web.Config)
public static void ProtectSection(String sSectionName)
{
// Open the app.config file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Get the section in the file.
ConfigurationSection section = config.GetSection(sSectionName);
// If the section exists and the section is not readonly, then protect the section.
if (section != null)
{
if (!section.IsReadOnly())
{
// Protect the section.
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
section.SectionInformation.ForceSave = true;
// Save the change.
config.Save(ConfigurationSaveMode.Modified);
}
}
<span id="more-1109"></span>
Nenhum post foi relacionado a este
| Imprimir artigo | Este artigo foi escrito por paulodiogo em 3 03UTC outubro 03UTC 2010 às 0:47, e está arquivado em .NET, ASP.NET. Siga quaisquer respostas a este artigo através do RSS 2.0. Você pode deixar uma resposta ou fazer um trackback do seu próprio site. |
