0
votes

I have website that uses ASP.net Membership Provider. This web site will be served by a set of WCF services. I need to extract a profile variable from the user currently calling the service in the service layer. I am using wsHttpBinding and I am following below MSDN article.

how to use the ASP.NET Membership provider in WCF

Can anyone help me with client settings for this example?

1

1 Answers

0
votes

Your client configuration should match the server config:

<configuration>
  <system.serviceModel>
       ...
       <bindings>
          <wsHttpBinding>
            <binding name="MembershipBinding">
              <security mode="Message">
                <message clientCredentialType="UserName" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
  </system.serviceModel>
</configuration>

When you connect to your service you need to set the username and password on the client proxy:

    client.ClientCredentials.UserName.UserName = "userName";
    client.ClientCredentials.UserName.Password = "password";