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 name attribute to an appropriate value. This example uses the name "SecureBinding".
Add a <security> binding. Set the mode attribute to an appropriate value. This example sets it to "Message".
Add either a <message> or <transport> element, as determined by the security mode. Set the clientCredentialType attribute to an appropriate value. This example uses "Windows".
<system.serviceModel> <bindings> <wsHttpBinding> <binding name="SecureBinding"> <security mode="Message"> <message clientCredentialType="Windows" /> </security> </binding> </wsHttpBinding> </bindings> </system.serviceModel>