Share via


SecurityCallContext.CurrentCall Propiedad

Definición

Obtiene un objeto SecurityCallContext que describe el contexto de la llamada de seguridad.

public:
 static property System::EnterpriseServices::SecurityCallContext ^ CurrentCall { System::EnterpriseServices::SecurityCallContext ^ get(); };
public static System.EnterpriseServices.SecurityCallContext CurrentCall { get; }
static member CurrentCall : System.EnterpriseServices.SecurityCallContext
Public Shared ReadOnly Property CurrentCall As SecurityCallContext

Valor de propiedad

El objeto SecurityCallContext que describe el contexto de la llamada de seguridad.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este método para obtener un SecurityCallContext objeto que describa el contexto de seguridad de una llamada de método.

// Set the employee's salary. Only managers can do this.
void SetSalary( double ammount )
{
   if ( SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) )
   {
      salary = ammount;
   }
   else
   {
      throw gcnew UnauthorizedAccessException;
   }
}
// Set the employee's salary. Only managers can do this.
public void SetSalary (double ammount)
{
    if (SecurityCallContext.CurrentCall.IsCallerInRole("Manager"))
    {
        salary = ammount;
    }
    else
    {
        throw new UnauthorizedAccessException();
    }
}
' Set the employee's salary. Only managers can do this.
Public Sub SetSalary(ByVal ammount As Double) 
    If SecurityCallContext.CurrentCall.IsCallerInRole("Manager") Then
        salary = ammount
    Else
        Throw New UnauthorizedAccessException()
    End If

End Sub

Comentarios

La propiedad estática CurrentCall es la manera recomendada de acceder al contexto de llamada de seguridad.

Se aplica a