RoleManagerSection.CreatePersistentCookie 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示是使用基於會話的 cookie 還是持久性 cookie 來快取角色名稱。
public:
property bool CreatePersistentCookie { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("createPersistentCookie", DefaultValue=false)]
public bool CreatePersistentCookie { get; set; }
[<System.Configuration.ConfigurationProperty("createPersistentCookie", DefaultValue=false)>]
member this.CreatePersistentCookie : bool with get, set
Public Property CreatePersistentCookie As Boolean
屬性值
true讓角色名稱的 Cookie 在瀏覽器會話間持續存在;否則,。 false 預設值為 false。
- 屬性
範例
以下程式碼範例示範如何使用該 CreatePersistentCookie 屬性。 此程式碼範例是本類別更大範例 RoleManagerSection 的一部分。
// Display CreatePersistentCookie property.
Console.WriteLine("CreatePersistentCookie: {0}",
configSection.CreatePersistentCookie);
' Display CreatePersistentCookie property.
Console.WriteLine("CreatePersistentCookie: {0}", _
configSection.CreatePersistentCookie)
備註
此 CreatePersistentCookie 屬性表示用於快取角色名稱的 Cookie 應是基於 session 的 cookie,即瀏覽器關閉時 cookie 會遺失,還是持久性 Cookie,表示 Cookie 在瀏覽器會話間可存取。 預設為 false,表示使用基於會話的 cookie 來快取角色名稱。