Saturday, November 14, 2009

Error "The username is not provided. Specify username in ClientCredentials."

Issue:
Error "The username is not provided. Specify username in ClientCredentials." while calling secured web service "HTTPS".

Cause:
Actually there're three causes with my application:
  1. Security mode was not appropriae.
  2. Client credential type was not appropriate.
  3. The call missed passing the required Username and Passwoed.

Solution:

The solution was in setting the apporpiate security mode, client credentials type and passing the required username and password.

  1. Set the appropriate Security mode in the configuration file (app.config OR web.config),it's should be "Transport":
security mode="Transport"


  1. Set the appropriate client credential type in the configuration file (app.config OR web.config),it's should be "Basic":

transport clientcredentialtype="Basic"

  1. Pass the required username and password:

proxy.ClientCredentials.UserName.UserName = "xyz";
proxy.ClientCredentials.UserName.Password = "123";

Ahmed A.Moneim