ProfileSection.Inherits Property


Gets or sets a type reference for a custom type derived from ProfileBase.

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

[ConfigurationPropertyAttribute("inherits", DefaultValue = "")]
public string Inherits { get; set; }

Property Value

Type: System.String

A valid type reference, or an empty string (""). The default is an empty string.

At run time, the ASP.NET compilation system uses the information specified in the profile section of the configuration to generate a class called ProfileCommon, which is derived from ProfileBase. To customize the information this class provides, you can set the Inherits property to the name of a type you create that derives from ProfileBase, and the compilation system will use this custom type as the base class for ProfileCommon.


If you provide a type reference in the Inherits property, you can define properties in your custom types that are not defined with a property element.

For more information about the profile features added to ASP.NET 2.0, see ASP.NET Profile Properties Overview.

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

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

// Set the Inherits property to
// "CustomProfiles.MyCustomProfile, CustomProfiles.dll".
profileSection.Inherits = "CustomProfiles.MyCustomProfile, CustomProfiles.dll";

.NET Framework
Available since 2.0
Return to top