RightsManagementException Costruttori
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Inizializza una nuova istanza della classe RightsManagementException.
Overload
Esempio
Nell'esempio seguente viene illustrato l'uso RightsManagementExceptiondi .
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()
Inizializza una nuova istanza della classe RightsManagementException.
public:
RightsManagementException();
public RightsManagementException ();
Public Sub New ()
Esempio
Nell'esempio seguente viene illustrato l'uso RightsManagementExceptiondi .
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
Si applica a
RightsManagementException(RightsManagementFailureCode)
Inizializza una nuova istanza della classe RightsManagementException con un oggetto RightsManagementFailureCode specificato.
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)
Parametri
- failureCode
- RightsManagementFailureCode
Codice di errore per l'errore.
Esempio
Nell'esempio seguente viene illustrato l'uso FailureCode della proprietà per creare un messaggio di errore per l'utente.
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
Si applica a
RightsManagementException(String)
Inizializza una nuova istanza della classe RightsManagementException con un messaggio specificato.
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)
Parametri
- message
- String
Messaggio in cui viene descritto l'errore,
Esempio
Nell'esempio seguente viene illustrato l'uso Message della proprietà per creare un messaggio di errore per l'utente.
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
Si applica a
RightsManagementException(SerializationInfo, StreamingContext)
Inizializza una nuova istanza della classe RightsManagementException e imposta l'archivio SerializationInfo con le informazioni sull'eccezione.
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)
Parametri
- info
- SerializationInfo
Oggetto contenente i dati serializzati.
- context
- StreamingContext
Informazioni contestuali sull'origine o sulla destinazione.
Vedi anche
Si applica a
RightsManagementException(RightsManagementFailureCode, Exception)
Inizializza una nuova istanza della classe RightsManagementException con un oggetto RightsManagementFailureCode e un oggetto InnerException specificati.
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)
Parametri
- failureCode
- RightsManagementFailureCode
Codice di errore per l'errore.
- innerException
- Exception
Istanza di eccezione che ha causato l'errore.
Esempio
Nell'esempio seguente viene illustrato l'uso delle FailureCode proprietà e Message per creare un messaggio di errore per l'utente.
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
Si applica a
RightsManagementException(RightsManagementFailureCode, String)
Inizializza una nuova istanza della classe RightsManagementException con un oggetto RightsManagementFailureCode e un oggetto Message specificati.
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)
Parametri
- failureCode
- RightsManagementFailureCode
Codice di errore per l'errore.
- message
- String
Messaggio in cui viene descritto l'errore,
Esempio
Nell'esempio seguente viene illustrato l'uso delle FailureCode proprietà e Message per creare un messaggio di errore per l'utente.
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
Si applica a
RightsManagementException(String, Exception)
Inizializza una nuova istanza della classe RightsManagementException con un oggetto Message e un oggetto InnerException specificati.
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)
Parametri
- message
- String
Messaggio in cui viene descritto l'errore,
- innerException
- Exception
Istanza di eccezione che ha causato questa eccezione.
Esempio
Nell'esempio seguente viene illustrato l'uso Message della proprietà per creare un messaggio di errore per l'utente.
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
Si applica a
RightsManagementException(RightsManagementFailureCode, String, Exception)
Inizializza una nuova istanza della classe RightsManagementException con un oggetto RightsManagementFailureCode, un oggetto Message e un oggetto InnerException specificati.
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)
Parametri
- failureCode
- RightsManagementFailureCode
Codice di errore per l'errore.
- message
- String
Messaggio in cui viene descritto l'errore,
- innerException
- Exception
Istanza di eccezione che ha causato l'errore.
Esempio
Nell'esempio seguente viene illustrato l'uso delle FailureCode proprietà e Message per creare un messaggio di errore per l'utente.
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