Export (0) Print
Expand All

IClientFormsAuthenticationCredentialsProvider Interface

Defines a method that the ClientFormsAuthenticationMembershipProvider class calls to retrieve user credentials.

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

public interface IClientFormsAuthenticationCredentialsProvider

The IClientFormsAuthenticationCredentialsProvider type exposes the following members.

  NameDescription
Public methodGetCredentialsRetrieves user credentials.
Top

When using forms authentication with client application services, you can pass a user name and password to the ValidateUser method. You can also pass empty strings or null as the parameters to use a credentials provider. A credentials provider is a class that you provide and specify in your application configuration. A credentials provider class must implement the IClientFormsAuthenticationCredentialsProvider interface, which has a single method named GetCredentials. A typical GetCredentials method implementation will display a dialog box to retrieve user input. Using a credentials provider enables you to share a single login dialog box among multiple applications. For more information, see How to: Implement User Login with Client Application Services.

The following example code demonstrates how to implement the GetCredentials method, which is the only member in this interface. In this example, the GetCredentials method is part of a login dialog box class. This 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;
    }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft