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 Sub New (
	failureCode As RightsManagementFailureCode,
	message As String,
	innerException As Exception


Type: System.Security.RightsManagement.RightsManagementFailureCode

The failure code for the error.

Type: System.String

A message that describes the error.

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.")
	Dim applicationManifest As String = "<manifest></manifest>"
	If File.Exists("rpc.xml") Then
		Dim manifestReader As StreamReader = File.OpenText("rpc.xml")
		applicationManifest = manifestReader.ReadToEnd()
	End If

	If _secureEnv Is Nothing Then
		If SecureEnvironment.IsUserActivated(New ContentUser(_currentUserId, AuthenticationType.Windows)) Then
			_secureEnv = SecureEnvironment.Create(applicationManifest, New ContentUser(_currentUserId, AuthenticationType.Windows))
			_secureEnv = SecureEnvironment.Create(applicationManifest, AuthenticationType.Windows, UserActivationMode.Permanent)
		End If
	End If
Catch ex As RightsManagementException
	MessageBox.Show("ERROR: Failed to build secure environment." & vbLf & "Exception: " & ex.Message & vbLf & vbLf & ex.FailureCode.ToString() & vbLf & vbLf & ex.StackTrace, "Rights Management Exception", MessageBoxButton.OK, MessageBoxImage.Error)
	Return False
End Try

.NET Framework
Available since 3.0
Return to top