ClientFormsAuthenticationCredentials(String, String, Boolean) Constructor

Definition

Initializes a new instance of the ClientFormsAuthenticationCredentials class.

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)

Parameters

username
String

The user name.

password
String

The user password.

rememberMe
Boolean

A value indicating whether the user credentials should be saved and reused for subsequent login attempts.

Examples

The following example code demonstrates how to implement the IClientFormsAuthenticationCredentialsProvider.GetCredentials method, which returns an instance of this class. In this example, the GetCredentials method is part of a login dialog box class. The method displays the dialog box, and then returns a ClientFormsAuthenticationCredentials instance initialized with the user-specified values.

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

Remarks

You will typically pass user-provided values as the parameters of this constructor.

Applies to

See also