共用方式為


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

適用於

另請參閱