SecurityException Construtores
Definição
Inicializa uma nova instância da classe SecurityException.Initializes a new instance of the SecurityException class.
Sobrecargas
| SecurityException() |
Inicializa uma nova instância da classe SecurityException com propriedades padrão.Initializes a new instance of the SecurityException class with default properties. |
| SecurityException(String) |
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada.Initializes a new instance of the SecurityException class with a specified error message. |
| SecurityException(SerializationInfo, StreamingContext) |
Inicializa uma nova instância da classe SecurityException com dados serializados.Initializes a new instance of the SecurityException class with serialized data. |
| SecurityException(String, Exception) |
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada e uma referência à exceção interna que é a causa da exceção.Initializes a new instance of the SecurityException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
| SecurityException(String, Type) |
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada e o tipo de permissão que fez a exceção ser gerada.Initializes a new instance of the SecurityException class with a specified error message and the permission type that caused the exception to be thrown. |
| SecurityException(String, Type, String) |
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada, o tipo de permissão que fez a exceção ser gerada e o estado da permissão.Initializes a new instance of the SecurityException class with a specified error message, the permission type that caused the exception to be thrown, and the permission state. |
| SecurityException(String, Object, Object, MethodInfo, Object, IPermission) |
Inicializa uma nova instância da classe SecurityException para uma exceção causada por uma Negação na pilha.Initializes a new instance of the SecurityException class for an exception caused by a Deny on the stack. |
| SecurityException(String, AssemblyName, PermissionSet, PermissionSet, MethodInfo, SecurityAction, Object, IPermission, Evidence) |
Inicializa uma nova instância da classe SecurityException para uma exceção causada por um conjunto de concessões insuficiente.Initializes a new instance of the SecurityException class for an exception caused by an insufficient grant set. |
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
SecurityException()
Inicializa uma nova instância da classe SecurityException com propriedades padrão.Initializes a new instance of the SecurityException class with default properties.
public:
SecurityException();
public SecurityException ();
Public Sub New ()
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
A tabela a seguir mostra os valores de propriedade iniciais para uma instância da SecurityException classe.The following table shows the initial property values for an instance of the SecurityException class.
| PropriedadeProperty | ValorValue |
|---|---|
| InnerException | Uma referência nula (Nothing no Visual Basic).A null reference (Nothing in Visual Basic). |
| Message | A cadeia de caracteres da mensagem de erro localizada.The localized error message string. |
Aplica-se a
SecurityException(String)
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada.Initializes a new instance of the SecurityException class with a specified error message.
public:
SecurityException(System::String ^ message);
public SecurityException (string message);
public SecurityException (string? message);
new System.Security.SecurityException : string -> System.Security.SecurityException
Public Sub New (message As String)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
A tabela a seguir mostra os valores de propriedade iniciais para uma instância da SecurityException classe.The following table shows the initial property values for an instance of the SecurityException class.
| PropriedadeProperty | ValorValue |
|---|---|
| InnerException | Uma referência nula (Nothing no Visual Basic).A null reference (Nothing in Visual Basic). |
| Message | A cadeia de caracteres da mensagem de erro localizada.The localized error message string. |
Aplica-se a
SecurityException(SerializationInfo, StreamingContext)
Inicializa uma nova instância da classe SecurityException com dados serializados.Initializes a new instance of the SecurityException class with serialized data.
protected:
SecurityException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected SecurityException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.SecurityException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.SecurityException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parâmetros
- info
- SerializationInfo
O objeto que mantém os dados de objeto serializados.The object that holds the serialized object data.
- context
- StreamingContext
As informações contextuais sobre a origem ou o destino.The contextual information about the source or destination.
Exceções
info é null.info is null.
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
O construtor é chamado durante a desserialização para reconstituir o objeto de exceção transmitido em um fluxo.This constructor is called during deserialization to reconstitute the exception object transmitted over a stream.
Esse construtor define os seguintes valores de propriedade com base nas informações no info parâmetro:This constructor sets the following property values based on the information in the info parameter:
Aplica-se a
SecurityException(String, Exception)
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada e uma referência à exceção interna que é a causa da exceção.Initializes a new instance of the SecurityException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
SecurityException(System::String ^ message, Exception ^ inner);
public SecurityException (string message, Exception inner);
public SecurityException (string? message, Exception? inner);
new System.Security.SecurityException : string * Exception -> System.Security.SecurityException
Public Sub New (message As String, inner As Exception)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
- inner
- Exception
A exceção que é a causa da exceção atual.The exception that is the cause of the current exception. Caso o parâmetro inner não seja null, a exceção atual é acionada em um bloco catch que identifica a exceção interna.If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
Uma exceção que é lançada como um resultado direto de uma exceção anterior deve incluir uma referência para a exceção anterior na propriedade InnerException.An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. A propriedade InnerException retorna o mesmo valor passado ao construtor, ou null se a propriedade InnerException não fornecer o valor da exceção interna ao construtor.The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.
A tabela a seguir mostra os valores de propriedade iniciais para uma instância da SecurityException classe.The following table shows the initial property values for an instance of the SecurityException class.
| PropriedadeProperty | ValorValue |
|---|---|
| InnerException | A referência de exceção interna.The inner exception reference. |
| Message | A cadeia de caracteres da mensagem de erro localizada.The localized error message string. |
Confira também
Aplica-se a
SecurityException(String, Type)
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada e o tipo de permissão que fez a exceção ser gerada.Initializes a new instance of the SecurityException class with a specified error message and the permission type that caused the exception to be thrown.
public:
SecurityException(System::String ^ message, Type ^ type);
public SecurityException (string? message, Type? type);
public SecurityException (string message, Type type);
new System.Security.SecurityException : string * Type -> System.Security.SecurityException
Public Sub New (message As String, type As Type)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
- type
- Type
O tipo da permissão que fez a exceção ser gerada.The type of the permission that caused the exception to be thrown.
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
A tabela a seguir mostra os valores de propriedade definidos por esse construtor.The following table shows the property values set by this constructor.
| PropriedadeProperty | ValorValue |
|---|---|
| Message | A cadeia de caracteres de mensagem de erro localizada especificada por message .The localized error message string specified by message. |
| PermissionType | O Type da permissão que falhou, especificada por type .The Type of the permission that failed, specified by type. |
Aplica-se a
SecurityException(String, Type, String)
Inicializa uma nova instância da classe SecurityException com uma mensagem de erro especificada, o tipo de permissão que fez a exceção ser gerada e o estado da permissão.Initializes a new instance of the SecurityException class with a specified error message, the permission type that caused the exception to be thrown, and the permission state.
public:
SecurityException(System::String ^ message, Type ^ type, System::String ^ state);
public SecurityException (string? message, Type? type, string? state);
public SecurityException (string message, Type type, string state);
new System.Security.SecurityException : string * Type * string -> System.Security.SecurityException
Public Sub New (message As String, type As Type, state As String)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
- type
- Type
O tipo da permissão que fez a exceção ser gerada.The type of the permission that caused the exception to be thrown.
- state
- String
O estado da permissão que fez a exceção ser gerada.The state of the permission that caused the exception to be thrown.
Exemplos
Para obter um exemplo do uso de um SecurityException Construtor, consulte o exemplo fornecido para o SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Comentários
A tabela a seguir mostra os valores de propriedade definidos por esse construtor.The following table shows the property values set by this constructor.
| PropriedadeProperty | ValorValue |
|---|---|
| Message | A cadeia de caracteres de mensagem de erro localizada especificada por message .The localized error message string specified by message. |
| PermissionType | O Type da permissão que falhou, especificada por type .The Type of the permission that failed, specified by type. |
| Demanded | A permissão de segurança solicitada, o conjunto de permissões ou a coleção de conjuntos de permissões que falharam.The demanded security permission, permission set, or permission set collection that failed. |
Aplica-se a
SecurityException(String, Object, Object, MethodInfo, Object, IPermission)
Inicializa uma nova instância da classe SecurityException para uma exceção causada por uma Negação na pilha.Initializes a new instance of the SecurityException class for an exception caused by a Deny on the stack.
public:
SecurityException(System::String ^ message, System::Object ^ deny, System::Object ^ permitOnly, System::Reflection::MethodInfo ^ method, System::Object ^ demanded, System::Security::IPermission ^ permThatFailed);
public SecurityException (string message, object deny, object permitOnly, System.Reflection.MethodInfo method, object demanded, System.Security.IPermission permThatFailed);
new System.Security.SecurityException : string * obj * obj * System.Reflection.MethodInfo * obj * System.Security.IPermission -> System.Security.SecurityException
Public Sub New (message As String, deny As Object, permitOnly As Object, method As MethodInfo, demanded As Object, permThatFailed As IPermission)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
- deny
- Object
A permissão ou o conjunto de permissões negado.The denied permission or permission set.
- permitOnly
- Object
A permissão ou o conjunto de permissões somente de permissão.The permit-only permission or permission set.
- method
- MethodInfo
Um MethodInfo que identifica o método que encontrou a exceção.A MethodInfo that identifies the method that encountered the exception.
- demanded
- Object
A permissão, o conjunto de permissões ou a coleção de conjunto de permissões exigida.The demanded permission, permission set, or permission set collection.
- permThatFailed
- IPermission
Um IPermission que identifica a permissão que falhou.An IPermission that identifies the permission that failed.
Exemplos
O exemplo de código a seguir mostra o uso do SecurityException(String, Object, Object, MethodInfo, Object, IPermission) Construtor.The following code example shows the use of the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
// Demonstrate the SecurityException constructor
// by throwing the exception again.
Display("Rethrowing the exception thrown as a "
"result of a PermitOnly security action.");
throw gcnew SecurityException(exception->Message,
exception->DenySetInstance,
exception->PermitOnlySetInstance,
exception->Method, exception->Demanded,
exception->FirstPermissionThatFailed);
//Demonstrate the SecurityException constructor by
// throwing the exception again.
Display("Rethrowing the exception thrown as a result of a " +
"PermitOnly security action.");
throw new SecurityException(sE.Message, sE.DenySetInstance,
sE.PermitOnlySetInstance, sE.Method, sE.Demanded,
(IPermission)sE.FirstPermissionThatFailed);
' Demonstrate the SecurityException constructor by
' throwing the exception again.
Display("Rethrowing the exception thrown as a result of a " & _
"PermitOnly security action.")
Throw New SecurityException(sE.Message, sE.DenySetInstance, _
sE.PermitOnlySetInstance, sE.Method, sE.Demanded, _
CType(sE.FirstPermissionThatFailed, IPermission))
Comentários
Use este construtor se um quadro que contém uma negação causou a falha de demanda.Use this constructor if a frame that contains a Deny caused the demand failure. A tabela a seguir mostra os valores de propriedade definidos por esse construtor.The following table shows the property values set by this constructor.
| PropriedadeProperty | ValorValue |
|---|---|
| Message | A cadeia de caracteres de mensagem de erro localizada especificada por message .The localized error message string specified by message. |
| FirstPermissionThatFailed | A primeira permissão no conjunto de permissões ou na coleção de conjuntos de permissões especificado por permThatFailed .The first permission in the permission set or permission set collection specified by permThatFailed. |
| GrantedSet | Uma cadeia de caracteres vazia.An empty string. |
| Demanded | A permissão de segurança, o conjunto de permissões ou a coleção de conjuntos de permissões especificados por demanded .The security permission, permission set, or permission set collection specified by demanded. |
| RefusedSet | Uma cadeia de caracteres vazia.An empty string. |
| DenySetInstance | A permissão de segurança negada, o conjunto de permissões ou a coleção de conjuntos de permissões especificados por deny .The denied security permission, permission set, or permission set collection specified by deny. |
| PermitOnlySetInstance | A permissão, o conjunto de permissões ou a coleção de conjuntos de permissões especificados por permitOnly .The permission, permission set, or permission set collection specified by permitOnly. |
| FailedAssemblyInfo | null.null. |
| Method | O MethodInfo especificado por method.The MethodInfo specified by method. |
| Zone | NoZone.NoZone. |
| Url | Uma cadeia de caracteres vazia.An empty string. |
Aplica-se a
SecurityException(String, AssemblyName, PermissionSet, PermissionSet, MethodInfo, SecurityAction, Object, IPermission, Evidence)
Inicializa uma nova instância da classe SecurityException para uma exceção causada por um conjunto de concessões insuficiente.Initializes a new instance of the SecurityException class for an exception caused by an insufficient grant set.
public:
SecurityException(System::String ^ message, System::Reflection::AssemblyName ^ assemblyName, System::Security::PermissionSet ^ grant, System::Security::PermissionSet ^ refused, System::Reflection::MethodInfo ^ method, System::Security::Permissions::SecurityAction action, System::Object ^ demanded, System::Security::IPermission ^ permThatFailed, System::Security::Policy::Evidence ^ evidence);
public SecurityException (string message, System.Reflection.AssemblyName assemblyName, System.Security.PermissionSet grant, System.Security.PermissionSet refused, System.Reflection.MethodInfo method, System.Security.Permissions.SecurityAction action, object demanded, System.Security.IPermission permThatFailed, System.Security.Policy.Evidence evidence);
new System.Security.SecurityException : string * System.Reflection.AssemblyName * System.Security.PermissionSet * System.Security.PermissionSet * System.Reflection.MethodInfo * System.Security.Permissions.SecurityAction * obj * System.Security.IPermission * System.Security.Policy.Evidence -> System.Security.SecurityException
Public Sub New (message As String, assemblyName As AssemblyName, grant As PermissionSet, refused As PermissionSet, method As MethodInfo, action As SecurityAction, demanded As Object, permThatFailed As IPermission, evidence As Evidence)
Parâmetros
- message
- String
A mensagem de erro que explica a razão da exceção.The error message that explains the reason for the exception.
- assemblyName
- AssemblyName
Um AssemblyName que especifica o nome do assembly que causou a exceção.An AssemblyName that specifies the name of the assembly that caused the exception.
- grant
- PermissionSet
Um PermissionSet que representa as permissões concedidas ao assembly.A PermissionSet that represents the permissions granted the assembly.
- refused
- PermissionSet
Um PermissionSet que representa a permissão ou o conjunto de permissões recusado.A PermissionSet that represents the refused permission or permission set.
- method
- MethodInfo
Um MethodInfo que representa o método que encontrou a exceção.A MethodInfo that represents the method that encountered the exception.
- action
- SecurityAction
Um dos valores de SecurityAction.One of the SecurityAction values.
- demanded
- Object
A permissão, o conjunto de permissões ou a coleção de conjunto de permissões exigida.The demanded permission, permission set, or permission set collection.
- permThatFailed
- IPermission
Um IPermission que representa a permissão que falhou.An IPermission that represents the permission that failed.
- evidence
- Evidence
O Evidence para o assembly que causou a exceção.The Evidence for the assembly that caused the exception.
Comentários
Use esse construtor para gerar uma exceção quando o conjunto de concessão tiver causado a falha da demanda.Use this constructor to throw an exception when the grant set caused the failure of the demand.
A tabela a seguir mostra os valores de propriedade definidos por esse construtor.The following table shows the property values set by this constructor.
| PropriedadeProperty | ValorValue |
|---|---|
| Message | A cadeia de caracteres de mensagem de erro localizada especificada por message .The localized error message string specified by message. |
| FirstPermissionThatFailed | A primeira permissão no conjunto de permissões ou na coleção de conjuntos de permissões especificado por permThatFailed .The first permission in the permission set or permission set collection specified by permThatFailed. |
| GrantedSet | O PermissionSet especificado por grant.The PermissionSet specified by grant. |
| Demanded | A permissão de segurança solicitada, o conjunto de permissões ou a coleção de conjuntos de permissões que falharam, especificada por demanded .The demanded security permission, permission set, or permission set collection that failed, specified by demanded. |
| RefusedSet | O PermissionSet especificado por refused.The PermissionSet specified by refused. |
| DenySetInstance | Uma cadeia de caracteres vazia.An empty string. |
| PermitOnlySetInstance | Uma cadeia de caracteres vazia.An empty string. |
| FailedAssemblyInfo | O AssemblyName especificado por assemblyName.The AssemblyName specified by assemblyName. |
| Method | O MethodInfo especificado por method.The MethodInfo specified by method. |
| Zone | O SecurityZone valor do Evidence especificado por evidence .The SecurityZone value from the Evidence specified by evidence. |
| Url | A URL do Evidence especificado por evidence .The URL from the Evidence specified by evidence. |