ProfileSection.Enabled 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示是否启用 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
属性值
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)的类。