RoleManagerSection.CreatePersistentCookie 属性

定义

指示是使用基于会话的 Cookie 还是使用持久性 Cookie 来缓存角色名称。Indicates whether a session-based cookie or a persistent cookie is used to cache role names.

public:
 property bool CreatePersistentCookie { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("createPersistentCookie", DefaultValue=Mono.Cecil.CustomAttributeArgument)]
public bool CreatePersistentCookie { get; set; }
[<System.Configuration.ConfigurationProperty("createPersistentCookie", DefaultValue=Mono.Cecil.CustomAttributeArgument)>]
member this.CreatePersistentCookie : bool with get, set
Public Property CreatePersistentCookie As Boolean

属性值

Boolean

若要使角色名称 Cookie 在浏览器会话之间得到保持,则为 true;否则,为 falsetrue to make the role names cookie persistent across browser sessions; otherwise, false. 默认值为 falseThe default is false.

属性

示例

下面的代码示例演示如何使用 CreatePersistentCookie 属性。The following code example demonstrates how to use the CreatePersistentCookie property. 此代码示例是为类提供的更大示例的一部分 RoleManagerSectionThis code example is part of a larger example provided for the RoleManagerSection class.

// Display CreatePersistentCookie property.
Console.WriteLine("CreatePersistentCookie: {0}",
  configSection.CreatePersistentCookie);
' Display CreatePersistentCookie property.
Console.WriteLine("CreatePersistentCookie: {0}", _
 configSection.CreatePersistentCookie)

注解

CreatePersistentCookie属性指示用于缓存角色名称的 cookie 是否应为基于会话的 cookie,这意味着关闭浏览器时 cookie 会丢失,或者是持久性 cookie,这意味着 cookie 可在浏览器会话中使用。The CreatePersistentCookie property indicates whether or not the cookie that is used to cache role names should be a session-based cookie, which means that the cookie is lost when the browser is closed, or a persistent cookie, which means that the cookie is available across browser sessions. 默认值为 false ,表示使用基于会话的 cookie 来缓存角色名称。The default is false, which indicates that a session-based cookie is used to cache role names.

适用于