RightsManagementException Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la classe RightsManagementException.
Surcharges
Exemples
L’exemple suivant illustre l’utilisation de .RightsManagementException
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()
Initialise une nouvelle instance de la classe RightsManagementException.
public:
RightsManagementException();
public RightsManagementException ();
Public Sub New ()
Exemples
L’exemple suivant illustre l’utilisation de .RightsManagementException
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
S’applique à
RightsManagementException(RightsManagementFailureCode)
Initialise une nouvelle instance de la classe RightsManagementException avec un RightsManagementFailureCode donné.
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)
Paramètres
- failureCode
- RightsManagementFailureCode
Le code d'erreur pour l'exception.
Exemples
L’exemple suivant illustre l’utilisation de la FailureCode propriété pour créer un message d’erreur pour l’utilisateur.
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
S’applique à
RightsManagementException(String)
Initialise une nouvelle instance de la classe RightsManagementException avec un message donné.
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)
Paramètres
- message
- String
Message qui décrit l'erreur.
Exemples
L’exemple suivant illustre l’utilisation de la Message propriété pour créer un message d’erreur pour l’utilisateur.
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
S’applique à
RightsManagementException(SerializationInfo, StreamingContext)
Initialise une nouvelle instance de la classe RightsManagementException et définit le magasin SerializationInfo avec les informations à propos de l'exception.
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)
Paramètres
- info
- SerializationInfo
Objet qui contient les données sérialisées.
- context
- StreamingContext
Informations contextuelles sur la source ou la destination.
Voir aussi
S’applique à
RightsManagementException(RightsManagementFailureCode, Exception)
Initialise une nouvelle instance de la classe RightsManagementException avec des propriétés RightsManagementFailureCode et InnerException données.
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)
Paramètres
- failureCode
- RightsManagementFailureCode
Le code d'erreur pour l'exception.
- innerException
- Exception
L'instance d'exception qui a provoqué l'erreur.
Exemples
L’exemple suivant montre l’utilisation FailureCode des propriétés et Message pour créer un message d’erreur pour l’utilisateur.
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
S’applique à
RightsManagementException(RightsManagementFailureCode, String)
Initialise une nouvelle instance de la classe RightsManagementException avec des propriétés RightsManagementFailureCode et Message données.
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)
Paramètres
- failureCode
- RightsManagementFailureCode
Le code d'erreur pour l'exception.
- message
- String
Message qui décrit l'erreur.
Exemples
L’exemple suivant montre l’utilisation FailureCode des propriétés et Message pour créer un message d’erreur pour l’utilisateur.
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
S’applique à
RightsManagementException(String, Exception)
Initialise une nouvelle instance de la classe RightsManagementException avec des propriétés Message et InnerException données.
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)
Paramètres
- message
- String
Message qui décrit l'erreur.
- innerException
- Exception
L'instance d'exception qui a entraîné la levée de cette exception.
Exemples
L’exemple suivant illustre l’utilisation de la Message propriété pour créer un message d’erreur pour l’utilisateur.
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
S’applique à
RightsManagementException(RightsManagementFailureCode, String, Exception)
Initialise une nouvelle instance de la classe RightsManagementException avec les RightsManagementFailureCode, Message et InnerException donnés.
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)
Paramètres
- failureCode
- RightsManagementFailureCode
Le code d'erreur pour l'exception.
- message
- String
Message qui décrit l'erreur.
- innerException
- Exception
L'instance d'exception qui a provoqué l'erreur.
Exemples
L’exemple suivant montre l’utilisation FailureCode des propriétés et Message pour créer un message d’erreur pour l’utilisateur.
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