Share via


SecurityCallContext.CurrentCall Proprietà

Definizione

Ottiene un oggetto SecurityCallContext che descrive il contesto di sicurezza della chiamata.

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

Valore della proprietà

Oggetto SecurityCallContext che descrive il contesto di sicurezza della chiamata.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo metodo per ottenere un oggetto che descrive il contesto di sicurezza di una chiamata a un SecurityCallContext metodo.

// 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

Commenti

La proprietà statica CurrentCall è il modo consigliato per accedere al contesto della chiamata di sicurezza.

Si applica a