This topic has not yet been rated - Rate this topic

RightsManagementException Constructor (RightsManagementFailureCode, String, Exception)

Initializes a new instance of the RightsManagementException class with a given RightsManagementFailureCode, Message and InnerException.

Namespace:  System.Security.RightsManagement
Assembly:  WindowsBase (in WindowsBase.dll)
public RightsManagementException(
	RightsManagementFailureCode failureCode,
	string message,
	Exception innerException
)

Parameters

failureCode
Type: System.Security.RightsManagement.RightsManagementFailureCode

The failure code for the error.

message
Type: System.String

A message that describes the error.

innerException
Type: System.Exception

The exception instance that caused the error.

The following example shows use of the FailureCode and Message properties to create an error message for the user.

WriteStatus("   Building secure environment.");
try
{
    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);
        }
    }
}
catch (RightsManagementException ex)
{
    MessageBox.Show("ERROR: Failed to build secure environment.\n" +
        "Exception: " + ex.Message + "\n\n" +
        ex.FailureCode.ToString() + "\n\n" + ex.StackTrace,
        "Rights Management Exception",
        MessageBoxButton.OK, MessageBoxImage.Error);
    return false;
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.