This project is read-only.

If your users are in a SQL membership store, use the SQL Membership Provider

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

If your user information is already stored in the aspnetdb database, or if you are building the application from scratch, use the SQL Membership provider to authenticate your WCF service clients. The Membership Provider will attempt to authenticate incoming client credentials against the credentials stored in the SQL Membership database.

The membership feature is a good choice as it allows you to enable user name authentication without writing and maintaining custom code.

The SQL Membership provider is configured in the Service config file. The following example demonstrates a Service SQL Membership Provider configuration.
    <add name="MyLocalSQLServer"
         connectionString="Initial Catalog=aspnetdb;data source=;Integrated Security=SSPI;"/>
      <membership defaultProvider="MySqlMembershipProvider" >
          <add name="MySqlMembershipProvider"
               type="System.Web.Security.SqlMembershipProvider" />

Set your binding to use UserName Authentication as follows
    <binding name="BindingConfiguration">
        <message clientCredentialType="UserName" />

Set the Service Credentials configuration to use the membership provider with username authentication
  <behavior name="BehaviorConfiguration">
      <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
        membershipProviderName="MySqlMembershipProvider" />

The following example demonstrates a client connection to the service:
// Set credentials to Alice
client.ClientCredentials.UserName.UserName = "Alice";
client.ClientCredentials.UserName.Password = "ecilA-123";

Last edited Apr 24, 2008 at 12:22 AM by prashantbansode, version 2


No comments yet.