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