Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ProviderSettings Class
Collapse the table of content
Expand the table of content

ProviderSettings Class

Represents the configuration elements associated with a provider.

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

public sealed class ProviderSettings : ConfigurationElement

ASP.NET uses providers to perform specific services required by a feature. For example, the membership feature uses a provider to coordinate the persistence of membership data in a database.

In a configuration file, individual providers are added to a providers element within a particular feature section.

The ProviderSettings class represents a particular group of settings that are added to the providers element within a configuration section. Typically the configuration attributes specified by the add directive include a name, type, and other properties.

The following code example shows how to use the ProviderSettings.

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Configuration;
using System.Security.Permissions;

namespace Samples.AspNet

    // Shows how to use the ProviderSettings. 
    public class UsingProviderSettings

        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
        private static void GetProviderSettings()
            // Get the application configuration file.
            System.Configuration.Configuration config =

            ProtectedConfigurationSection pSection =
                as ProtectedConfigurationSection;

            ProviderSettingsCollection providerSettings =

            foreach (ProviderSettings pSettings in

                    "Provider settings name: {0}",

                    "Provider settings type: {0}",

                NameValueCollection parameters =

                IEnumerator pEnum =

                int i = 0;
                while (pEnum.MoveNext())
                    string pLength =
                        "Provider ssettings: {0} has {1} parameters",
                        pSettings.Name, pLength);




        static void Main(string[] args)



The following is an excerpt of the configuration file used by the above example.

<?xml version="1.0" encoding="utf-8" ?>


      <clear />
         type="Samples.Aspnet.TripleDESProtectedConfigurationProvider, protectedconfigurationproviderlib, Version=, Culture=neutral, 
PublicKeyToken=79e01ae0f5cfc66f, processorArchitecture=MSIL" />




Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

© 2015 Microsoft