RoleManagerSection.CookieName 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用來快取角色名稱的 cookie 名稱。
public:
property System::String ^ CookieName { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Configuration.WhiteSpaceTrimStringConverter))]
[System.Configuration.ConfigurationProperty("cookieName", DefaultValue=".ASPXROLES")]
[System.Configuration.StringValidator(MinLength=1)]
public string CookieName { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Configuration.WhiteSpaceTrimStringConverter))>]
[<System.Configuration.ConfigurationProperty("cookieName", DefaultValue=".ASPXROLES")>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.CookieName : string with get, set
Public Property CookieName As String
屬性值
用來快取角色名稱的 cookie 名稱。 預設為「。ASPXROLES」。
- 屬性
範例
以下程式碼範例示範如何使用該 CookieName 屬性。 此程式碼範例是本類別更大範例 RoleManagerSection 的一部分。
// Display CookieName property.
Console.WriteLine("CookieName: {0}", configSection.CookieName);
' Display CookieName property.
Console.WriteLine("CookieName: {0}", configSection.CookieName)
備註
該 CookieName 屬性會回傳用於快取角色名稱的 cookie 名稱。 你可以在 ASP.NET 應用程式的 Web.config 檔案中設定 cookieName Cookie 的名稱,指定角色快取的名稱。 當你想為應用程式唯一識別 Cookie,或是 Cookie 在多個應用程式間共享時,這非常有用。