Share via


RoleManagerSection.CookiePath 属性

定义

获取或设置用于缓存角色名称的 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 。 该路径区分大小写。

适用于