Language

ClientFormsAuthenticationCredentials(String, String, Boolean) コンストラクター

定義

ClientFormsAuthenticationCredentials クラスの新しいインスタンスを初期化します。

public:
 ClientFormsAuthenticationCredentials(System::String ^ username, System::String ^ password, bool rememberMe);
public ClientFormsAuthenticationCredentials(string username, string password, bool rememberMe);
new System.Web.ClientServices.Providers.ClientFormsAuthenticationCredentials : string * string * bool -> System.Web.ClientServices.Providers.ClientFormsAuthenticationCredentials
Public Sub New (username As String, password As String, rememberMe As Boolean)

パラメーター

username
String

ユーザー名。

password
String

ユーザー パスワード。

rememberMe
Boolean

ユーザー資格情報を保存して、以降のログイン試行に再利用するかどうかを示す値。

例

次のコード例は、このクラスのインスタンスを返す IClientFormsAuthenticationCredentialsProvider.GetCredentials メソッドを実装する方法を示しています。 この例では、 GetCredentials メソッドはログイン ダイアログ ボックス クラスの一部です。 このメソッドは、ダイアログ ボックスを表示し、ユーザー指定の値で初期化された ClientFormsAuthenticationCredentials インスタンスを返します。

public ClientFormsAuthenticationCredentials GetCredentials()
{
    if (this.ShowDialog() == DialogResult.OK)
    {
        return new ClientFormsAuthenticationCredentials(
            usernameTextBox.Text, passwordTextBox.Text,
            rememberMeCheckBox.Checked);
    }
    else
    {
        return null;
    }
}
Public Function GetCredentials() As  _
    ClientFormsAuthenticationCredentials Implements _
    IClientFormsAuthenticationCredentialsProvider.GetCredentials

    If Me.ShowDialog() = DialogResult.OK Then
        Return New ClientFormsAuthenticationCredentials( _
            UsernameTextBox.Text, PasswordTextBox.Text, _
            rememberMeCheckBox.Checked)
    Else
        Return Nothing
    End If

End Function

注釈

通常、このコンストラクターのパラメーターとしてユーザー指定の値を渡します。

適用対象

こちらもご覧ください