SecureEnvironment.IsUserActivated Method (ContentUser)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Indicates whether a given user has been activated for accessing rights managed content.

Namespace:   System.Security.RightsManagement
Assembly:  WindowsBase (in WindowsBase.dll)

public static bool IsUserActivated(
	ContentUser user
)

Parameters

user
Type: System.Security.RightsManagement.ContentUser

The user or user-group for granting access to rights managed content.

Return Value

Type: System.Boolean

true if the given user has been activated for accessing rights managed content; otherwise, false.

The following example shows use of the IsUserActivated method to determine if given user has been authorized to access rights managed content.

string applicationManifest = "<manifest></manifest>";
if (File.Exists("rpc.xml"))
{
    StreamReader manifestReader = File.OpenText("rpc.xml");
    applicationManifest = manifestReader.ReadToEnd();
}

if (_secureEnv == null)
{
    if (SecureEnvironment.IsUserActivated(new ContentUser(
                _currentUserId, AuthenticationType.Windows)))
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest, new ContentUser(
                _currentUserId, AuthenticationType.Windows));
    }
    else
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest,
            AuthenticationType.Windows,
            UserActivationMode.Permanent);
    }
}

.NET Framework
Available since 3.0
Return to top
Show: