Export (0) Print
Expand All

RightsManagementException.RightsManagementException(RightsManagementFailureCode, String, Exception) Constructor

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
)
public RightsManagementException (
	RightsManagementFailureCode failureCode, 
	String message, 
	Exception innerException
)
public function RightsManagementException (
	failureCode : RightsManagementFailureCode, 
	message : String, 
	innerException : Exception
)
You cannot use constructors in XAML.

Parameters

failureCode

The failure code for the error.

message

A message that describes the error.

innerException

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. For the full sample, see Rights Managed Package Publish Sample.

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;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft