How to: Specify the Client Credential Type
After setting a security mode (either transport or message), you have the option of setting the client credential type. This property specifies what type of credential the client must provide to the service for authentication. For more information about setting the security mode (a necessary step before setting the client credential type), see How to: Set the Security Mode.
To set the client credential type in code
Create an instance of the binding that the service will use. This example uses the WSHttpBinding binding.
Set the Mode property to an appropriate value. This example uses the Message mode.
To set the client credential type in configuration
Add a <system.ServiceModel> element to the configuration file.
As a child element, add a <bindings> element.
Add an appropriate binding. This example uses the <wsHttpBinding> element.
Add a <binding> element and set the
nameattribute to an appropriate value. This example uses the name "SecureBinding".
<security>binding. Set the
modeattribute to an appropriate value. This example sets it to
Add either a <message> or <transport> element, as determined by the security mode. Set the
clientCredentialTypeattribute to an appropriate value. This example uses
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="SecureBinding"> <security mode="Message"> <message clientCredentialType="Windows" /> </security> </binding> </wsHttpBinding> </bindings> </system.serviceModel>