Export (0) Print
Expand All

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)

'Declaration
<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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft