ProtectedConfigurationSection.DefaultProvider Свойство

Определение

Возвращает или задает имя объекта ProtectedConfigurationProvider по умолчанию в свойстве коллекции Providers.

public:
 property System::String ^ DefaultProvider { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("defaultProvider", DefaultValue="RsaProtectedConfigurationProvider")]
public string DefaultProvider { get; set; }
public string DefaultProvider { get; set; }
[<System.Configuration.ConfigurationProperty("defaultProvider", DefaultValue="RsaProtectedConfigurationProvider")>]
member this.DefaultProvider : string with get, set
member this.DefaultProvider : string with get, set
Public Property DefaultProvider As String

Значение свойства

Имя объекта ProtectedConfigurationProvider по умолчанию в свойстве коллекции объекта Providers.

Атрибуты

Примеры

В следующем примере кода показано, как использовать свойство DefaultProvider.

static void GetDefaultProvider()
{
    try
    {
        // Get the application configuration.
        Configuration config =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);

        // Get the protected configuration section.
        ProtectedConfigurationSection pcSection =
            (System.Configuration.ProtectedConfigurationSection)
            config.GetSection("configProtectedData");

        // Get the current DefaultProvider.
        Console.WriteLine(
            "Protected configuration section default provider:");
        Console.WriteLine("  {0}", pcSection.DefaultProvider);
    }
    catch (ConfigurationErrorsException e)
    {
        Console.WriteLine(e.ToString());
    }
}
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

Применяется к