SecurityCallContext.IsCallerInRole メソッド
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)

Dim instance As SecurityCallContext Dim role As String Dim returnValue As Boolean returnValue = instance.IsCallerInRole(role)
戻り値
直接の呼び出し元が、指定されたロールのメンバである場合は true。それ以外の場合は false。

このメソッドを使用して、ServicedComponent メソッドの呼び出し元が指定されたロールに存在するかどうかを確認する方法のコード例を次に示します。
' 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 'SetSalary
// 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(); } }


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SecurityCallContext.IsCallerInRole メソッドのページへのリンク