Export (0) Print
Expand All

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

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

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft