RightsManagementException Konstruktoren

Definition

Initialisiert eine neue Instanz der RightsManagementException-Klasse.

Überlädt

RightsManagementException()

Initialisiert eine neue Instanz der RightsManagementException-Klasse.

RightsManagementException(RightsManagementFailureCode)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einem angegebenen RightsManagementFailureCode.

RightsManagementException(String)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit der angegebenen Meldung.

RightsManagementException(SerializationInfo, StreamingContext)

Initialisiert eine neue Instanz der RightsManagementException-Klasse und gibt im SerializationInfo-Speicher Informationen zur Ausnahme an.

RightsManagementException(RightsManagementFailureCode, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen RightsManagementFailureCode und InnerException.

RightsManagementException(RightsManagementFailureCode, String)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen RightsManagementFailureCode und Message.

RightsManagementException(String, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen Message und InnerException.

RightsManagementException(RightsManagementFailureCode, String, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit RightsManagementFailureCode, Message und InnerException.

Beispiele

Das folgende Beispiel zeigt die RightsManagementExceptionVerwendung von .

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

RightsManagementException()

Initialisiert eine neue Instanz der RightsManagementException-Klasse.

public:
 RightsManagementException();
public RightsManagementException ();
Public Sub New ()

Beispiele

Das folgende Beispiel zeigt die RightsManagementExceptionVerwendung von .

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

Gilt für:

RightsManagementException(RightsManagementFailureCode)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einem angegebenen RightsManagementFailureCode.

public:
 RightsManagementException(System::Security::RightsManagement::RightsManagementFailureCode failureCode);
public RightsManagementException (System.Security.RightsManagement.RightsManagementFailureCode failureCode);
new System.Security.RightsManagement.RightsManagementException : System.Security.RightsManagement.RightsManagementFailureCode -> System.Security.RightsManagement.RightsManagementException
Public Sub New (failureCode As RightsManagementFailureCode)

Parameter

failureCode
RightsManagementFailureCode

Der Fehlercode des Fehlers.

Beispiele

Das folgende Beispiel zeigt die Verwendung der FailureCode -Eigenschaft, um eine Fehlermeldung für den Benutzer zu erstellen.

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

Gilt für:

RightsManagementException(String)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit der angegebenen Meldung.

public:
 RightsManagementException(System::String ^ message);
public RightsManagementException (string message);
new System.Security.RightsManagement.RightsManagementException : string -> System.Security.RightsManagement.RightsManagementException
Public Sub New (message As String)

Parameter

message
String

Eine Meldung mit einer Beschreibung des Fehlers.

Beispiele

Das folgende Beispiel zeigt die Verwendung der Message -Eigenschaft, um eine Fehlermeldung für den Benutzer zu erstellen.

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

Gilt für:

RightsManagementException(SerializationInfo, StreamingContext)

Initialisiert eine neue Instanz der RightsManagementException-Klasse und gibt im SerializationInfo-Speicher Informationen zur Ausnahme an.

protected:
 RightsManagementException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected RightsManagementException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.RightsManagement.RightsManagementException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.RightsManagement.RightsManagementException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameter

info
SerializationInfo

Das Objekt, das die serialisierten Daten enthält.

context
StreamingContext

Die Kontextinformationen zur Quelle bzw. zum Ziel.

Weitere Informationen

Gilt für:

RightsManagementException(RightsManagementFailureCode, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen RightsManagementFailureCode und InnerException.

public:
 RightsManagementException(System::Security::RightsManagement::RightsManagementFailureCode failureCode, Exception ^ innerException);
public RightsManagementException (System.Security.RightsManagement.RightsManagementFailureCode failureCode, Exception innerException);
new System.Security.RightsManagement.RightsManagementException : System.Security.RightsManagement.RightsManagementFailureCode * Exception -> System.Security.RightsManagement.RightsManagementException
Public Sub New (failureCode As RightsManagementFailureCode, innerException As Exception)

Parameter

failureCode
RightsManagementFailureCode

Der Fehlercode des Fehlers.

innerException
Exception

Die Ausnahmeinstanz, die diesen Fehler verursacht hat.

Beispiele

Das folgende Beispiel zeigt die Verwendung der FailureCode Eigenschaften und Message zum Erstellen einer Fehlermeldung für den Benutzer.

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

Gilt für:

RightsManagementException(RightsManagementFailureCode, String)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen RightsManagementFailureCode und Message.

public:
 RightsManagementException(System::Security::RightsManagement::RightsManagementFailureCode failureCode, System::String ^ message);
public RightsManagementException (System.Security.RightsManagement.RightsManagementFailureCode failureCode, string message);
new System.Security.RightsManagement.RightsManagementException : System.Security.RightsManagement.RightsManagementFailureCode * string -> System.Security.RightsManagement.RightsManagementException
Public Sub New (failureCode As RightsManagementFailureCode, message As String)

Parameter

failureCode
RightsManagementFailureCode

Der Fehlercode des Fehlers.

message
String

Eine Meldung mit einer Beschreibung des Fehlers.

Beispiele

Das folgende Beispiel zeigt die Verwendung der FailureCode Eigenschaften und Message zum Erstellen einer Fehlermeldung für den Benutzer.

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

Gilt für:

RightsManagementException(String, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit einer angegebenen Message und InnerException.

public:
 RightsManagementException(System::String ^ message, Exception ^ innerException);
public RightsManagementException (string message, Exception innerException);
new System.Security.RightsManagement.RightsManagementException : string * Exception -> System.Security.RightsManagement.RightsManagementException
Public Sub New (message As String, innerException As Exception)

Parameter

message
String

Eine Meldung mit einer Beschreibung des Fehlers.

innerException
Exception

Die Ausnahmeinstanz, die diese Ausnahme verursacht hat.

Beispiele

Das folgende Beispiel zeigt die Verwendung der Message -Eigenschaft, um eine Fehlermeldung für den Benutzer zu erstellen.

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

Gilt für:

RightsManagementException(RightsManagementFailureCode, String, Exception)

Initialisiert eine neue Instanz der RightsManagementException-Klasse mit RightsManagementFailureCode, Message und InnerException.

public:
 RightsManagementException(System::Security::RightsManagement::RightsManagementFailureCode failureCode, System::String ^ message, Exception ^ innerException);
public RightsManagementException (System.Security.RightsManagement.RightsManagementFailureCode failureCode, string message, Exception innerException);
new System.Security.RightsManagement.RightsManagementException : System.Security.RightsManagement.RightsManagementFailureCode * string * Exception -> System.Security.RightsManagement.RightsManagementException
Public Sub New (failureCode As RightsManagementFailureCode, message As String, innerException As Exception)

Parameter

failureCode
RightsManagementFailureCode

Der Fehlercode des Fehlers.

message
String

Eine Meldung mit einer Beschreibung des Fehlers.

innerException
Exception

Die Ausnahmeinstanz, die diesen Fehler verursacht hat.

Beispiele

Das folgende Beispiel zeigt die Verwendung der FailureCode Eigenschaften und Message zum Erstellen einer Fehlermeldung für den Benutzer.

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

Gilt für: