Share via


SecurityCallContext.CurrentCall プロパティ

定義

セキュリティ呼び出しコンテキストを説明する SecurityCallContext オブジェクトを取得します。

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

プロパティ値

セキュリティ呼び出しコンテキストを説明する SecurityCallContext オブジェクト。

次のコード例は、このメソッドを使用して、メソッド呼び出しのセキュリティ コンテキストを記述するオブジェクトを取得 SecurityCallContext する方法を示しています。

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

注釈

静的 CurrentCall プロパティは、セキュリティ呼び出しコンテキストにアクセスするための推奨される方法です。

適用対象