/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks ConnectionStringsWeb.Encrypt/VB/source.vb
32 строки
932 B
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
Option Explicit On Option Strict On Imports System.Configuration Imports System.Web.Configuration Class Program Shared Sub Main() End Sub ' <Snippet1> Shared Sub ToggleWebEncrypt() ' Open the Web.config file. Dim config As Configuration = WebConfigurationManager. _ OpenWebConfiguration("~") ' Get the connectionStrings section. Dim section As ConnectionStringsSection = DirectCast( _ config.GetSection("connectionStrings"), _ ConnectionStringsSection) ' Toggle encryption. If section.SectionInformation.IsProtected Then section.SectionInformation.UnprotectSection() Else section.SectionInformation.ProtectSection( _ "DataProtectionConfigurationProvider") End If ' Save changes to the Web.config file. config.Save() End Sub ' </Snippet1> End Class