Share via


RoleManagerSection.CookieName 属性

定义

获取或设置用于缓存角色名称的 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,这非常有用。

适用于