November 2008
Intermediate to advanced
935 pages
30h 36m
English
Because the Role Manager feature's main purpose is to supply an IPrincipal based object, it includes an implementation of this interface with the RolePrincipal class. The RolePrincipal is intended for use anywhere a Framework application (ASP.NET or non-ASP.NET) expects to find an IPrincipal for IsInRole calls. RolePrincipal also exposes some additional methods for retrieving all of a user's roles as well as for handling some of the work necessary when using cookie caching.
C#
public sealed class RolePrincipal : IPrincipal, ISerializable
{
//Constructors
public RolePrincipal(IIdentity identity, string encryptedTicket)
public RolePrincipal(IIdentity identity)
public RolePrincipal(string providerName, IIdentity identity)
public RolePrincipal(string providerName, IIdentity identity,
string encryptedTicket)
//Cookie caching related methods
public string ToEncryptedTicket()
//Role Manager and IPrincipal related functionality
public string[] GetRoles()
public bool IsInRole(string role)
public void SetDirty()
//Public properties not related to cookie caching
public int Version { get; }
public IIdentity Identity { get; }
public string ProviderName { get }
public bool IsRoleListCached { get; }
//Public properties related to cookie caching
public DateTime ExpireDate { get; }
public DateTime IssueDate { get; }
public bool Expired {get; }
public String CookiePath { get; }
public bool CachedListChanged { get; }
}
VB.NET
<Serializable(), AspNetHostingPermission( ...
Read now
Unlock full access