ClientFormsAuthenticationCredentials Constructor

ClientFormsAuthenticationCredentials Constructor

Initializes a new instance of the ClientFormsAuthenticationCredentials class.

Namespace:  System.Web.ClientServices.Providers
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public ClientFormsAuthenticationCredentials(
	string username,
	string password,
	bool rememberMe


Type: System.String

The user name.

Type: System.String

The user password.

Type: System.Boolean

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

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

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,
        return null;

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

Community Additions

© 2016 Microsoft