ClientWindowsAuthenticationMembershipProvider.ValidateUser メソッド

定義

現在のユーザーを、オペレーティング システムによって付与された ID を使用して自動的に認証します。

public:
 override bool ValidateUser(System::String ^ username, System::String ^ password);
public override bool ValidateUser (string username, string password);
override this.ValidateUser : string * string -> bool
Public Overrides Function ValidateUser (username As String, password As String) As Boolean

パラメーター

username
String

Empty または null である必要があります。

password
String

Empty または null である必要があります。

戻り値

常に true

例外

username が、Empty でも null でもありません。

- または -

password が、Empty でも null でもありません。

次のコード例では、このメソッドを使用して、Windows 認証を使用してユーザーを認証する方法を示します。

private bool ValidateUsingWindowsAuthentication()
{
    ClientWindowsAuthenticationMembershipProvider authProvider =
        System.Web.Security.Membership.Provider as
        ClientWindowsAuthenticationMembershipProvider;

    // Call ValidateUser and pass null values for the parameters.
    // This call always returns true.
    return authProvider.ValidateUser(null, null);
}
Private Function ValidateUsingWindowsAuthentication() As Boolean

    Dim authProvider As ClientWindowsAuthenticationMembershipProvider = _
        CType(System.Web.Security.Membership.Provider,  _
        ClientWindowsAuthenticationMembershipProvider)

    ' Call ValidateUser and pass Nothing for the parameters.
    ' This call always returns true.
    Return authProvider.ValidateUser(Nothing, Nothing)

End Function

注釈

クラスを使用 ClientWindowsAuthenticationMembershipProvider するようにアプリケーションを構成すると、 staticMembership.ValidateUser メソッドは実装にこのメソッドを使用します。 メソッドはClientWindowsAuthenticationMembershipProvider.ValidateUser現在のユーザーを自動的に認証し、 プロパティをClientRolePrincipalstaticThread.CurrentPrincipal現在WindowsIdentityの を含む オブジェクトに設定します。 ClientRoleProviderがアプリケーション用に構成されている場合は、 オブジェクトをClientRolePrincipal使用して、ロール サービスからユーザー ロール情報を取得できます。

適用対象

こちらもご覧ください