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 编译系统应生成可用于访问各个用户配置文件信息的类,则为 /&ASP.NET;否则为 。 默认值为 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)的类。

适用于

另请参阅