SecurityCallContext.DirectCaller プロパティ
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文SecurityIdentity 値。
使用例このメソッドを使用して、ServicedComponent メソッドの直接の呼び出し元の ID を確認する方法のコード例を次に示します。
' Get the employee's salary. Only the employee and managers can do this. Public Function GetSalary() As Double If SecurityCallContext.CurrentCall.DirectCaller.AccountName = accountName OrElse SecurityCallContext.CurrentCall.IsCallerInRole("Manager") Then Return salary Else Throw New UnauthorizedAccessException() End If End Function 'GetSalary
// Get the employee's salary. Only the employee and managers can do this. public double GetSalary () { if ( SecurityCallContext.CurrentCall.DirectCaller.AccountName == accountName || SecurityCallContext.CurrentCall.IsCallerInRole("Manager") ) { return(salary); } else { throw new UnauthorizedAccessException(); } }
// Get the employee's salary. Only the employee and managers can do this. double GetSalary() { if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) { return (salary); } else { throw gcnew UnauthorizedAccessException; } }
// Get the employee's salary. Only the employee and managers can do this. public double GetSalary() throws System.UnauthorizedAccessException { if (SecurityCallContext.get_CurrentCall().get_DirectCaller(). get_AccountName().Equals(accountName) || SecurityCallContext.get_CurrentCall(). IsCallerInRole("Manager")) { return salary; } else { throw new UnauthorizedAccessException(); } } //GetSalary
.NET Framework のセキュリティ
プラットフォーム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.DirectCaller プロパティのページへのリンク