This documentation is archived and is not being maintained.

ProfileSection.PropertySettings Property

Gets a RootProfilePropertySettingsCollection collection of ProfilePropertySettings objects.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)

public RootProfilePropertySettingsCollection PropertySettings { get; }
/** @property */
public RootProfilePropertySettingsCollection get_PropertySettings ()

public function get PropertySettings () : RootProfilePropertySettingsCollection

Not applicable.

Property Value

A RootProfilePropertySettingsCollection object that contains all the properties defined within the properties subsection of the profile section of the configuration file.

The PropertySettings property is a RootProfilePropertySettingsCollection that provides a collection of ProfilePropertySettings objects and a collection of ProfileGroupSettings objects, each of which provides a named collection of other ProfilePropertySettings objects. These collections are used by the ASP.NET compilation engine to dynamically generate a class called ProfileCommon, which is derived from ProfileBase. The properties of the ProfileCommon class consist of the properties defined in the two collections. In addition, each group property of the ProfileCommon class will contain its own properties, as defined for that group.

The following code example shows how to use the PropertySettings property. This code example is part of a larger example provided for the ProfileSection class.

// Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:");
int rootPPSCtr = 0;
foreach (ProfilePropertySettings rootPPS in profileSection.PropertySettings)
    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr,

// Get and modify a root ProfilePropertySettings object.
    "Display and modify 'LastReadDate' ProfilePropertySettings:");
ProfilePropertySettings profilePropertySettings =

// Get the current ReadOnly property value.
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly);

// Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true;

// Get the current AllowAnonymous property value.
    "Current AllowAnonymous value: '{0}'", profilePropertySettings.AllowAnonymous);

// Set the AllowAnonymous property to true.
profilePropertySettings.AllowAnonymous = true;

// Get the current SerializeAs property value.
    "Current SerializeAs value: '{0}'", profilePropertySettings.SerializeAs);

// Set the SerializeAs property to SerializationMode.Binary.
profilePropertySettings.SerializeAs = SerializationMode.Binary;

// Get the current Type property value.
    "Current Type value: '{0}'", profilePropertySettings.Type);

// Set the Type property to "System.DateTime".
profilePropertySettings.Type = "System.DateTime";

// Get the current DefaultValue property value.
    "Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue);

// Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004";

// Get the current ProviderName property value.
    "Current ProviderName value: '{0}'", profilePropertySettings.Provider);

// Set the ProviderName property to "AspNetSqlRoleProvider".
profilePropertySettings.Provider = "AspNetSqlRoleProvider";

// Get the current Name property value.
    "Current Name value: '{0}'", profilePropertySettings.Name);

// Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate";

// Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:");
int PGSCtr = 0;
foreach (ProfileGroupSettings propGroups in profileSection.PropertySettings.GroupSettings)
    Console.WriteLine("  {0}: ProfileGroupSetting '{1}'", ++PGSCtr,
    int PPSCtr = 0;
    foreach (ProfilePropertySettings props in propGroups.PropertySettings)
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr,

// Add a new group.
ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");

// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";

// Remove a PropertySettings from the group.

// Clear all PropertySettings from the group.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0