ProtectedConfigurationSection.DefaultProvider Property

 

Gets or sets the name of the default ProtectedConfigurationProvider object in the Providers collection property.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

<ConfigurationPropertyAttribute("defaultProvider", DefaultValue := "RsaProtectedConfigurationProvider")>
Public Property DefaultProvider As String

Property Value

Type: System.String

The name of the default ProtectedConfigurationProvider object in the Providers collection property.

The following code example shows how to use the DefaultProvider property.

Shared Sub GetDefaultProvider() 
    Try
        ' Get the application configuration.
        Dim config As Configuration = _
        ConfigurationManager.OpenExeConfiguration( _
        ConfigurationUserLevel.None)

        ' Get the protected configuration section.
        Dim pcSection _
        As ProtectedConfigurationSection = _
        CType(config.GetSection( _
        "configProtectedData"), _
        System.Configuration.ProtectedConfigurationSection)

        ' Get the current DefaultProvider.
        Console.WriteLine( _
        "Protected configuration section default provider:")
        Console.WriteLine("{0}", _
        pcSection.DefaultProvider)

    Catch e As ConfigurationErrorsException
        Console.WriteLine(e.ToString())
    End Try

End Sub 'GetDefaultProvider

.NET Framework
Available since 2.0
Return to top
Show: