Export (0) Print
Expand All

RightsManagementException Constructor (RightsManagementFailureCode)

Initializes a new instance of the RightsManagementException class with a given RightsManagementFailureCode.

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

'Declaration
Public Sub New ( _
	failureCode As RightsManagementFailureCode _
)

Parameters

failureCode
Type: System.Security.RightsManagement.RightsManagementFailureCode

The failure code for the error.

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

				WriteStatus("   Building secure environment.")
				Try
					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))
						Else
							_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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, 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.

Show:
© 2014 Microsoft