Share via


ProfileSection.Enabled 属性

定义

获取或设置一个值,该值指示是否启用 ASP.NET 配置文件功能。

public:
 property bool Enabled { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("enabled", DefaultValue=true)]
public bool Enabled { get; set; }
[<System.Configuration.ConfigurationProperty("enabled", DefaultValue=true)>]
member this.Enabled : bool with get, set
Public Property Enabled As Boolean

属性值

如果 ASP.NET 编译系统应生成可用于访问单个用户配置文件信息的 true 类,则为 ProfileCommon;否则为 false。 默认值为 true

属性

示例

下面的代码示例说明如何使用 Enabled 属性。 此代码示例是为 ProfileSection 类提供的一个更大示例的一部分。


// Get the current Enabled property value.
Console.WriteLine(
    "Current Enabled value: '{0}'", profileSection.Enabled);

// Set the Enabled property to false.
profileSection.Enabled = false;

' Get the current Enabled property value.
Console.WriteLine( _
    "Current Enabled value: '{0}'", profileSection.Enabled)

' Set the Enabled property to false.
profileSection.Enabled = false

注解

Enabled当 属性为 false时,将禁用配置文件功能,并且你将无法从 ASP.NET 代码访问用户配置文件信息。

当 属性为 true时,ASP.NET 编译系统在运行时使用 节中指定的 profile 信息生成名为 ProfileCommon的类,该类派生自 ProfileBase

适用于

另请参阅