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.

NoteNote

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.
Console.WriteLine(
    "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.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft