title: How to pass credentials to a SOAP webservice?
body: <p>I am trying to call a SOAP webservice, however I am getting the error:
  Additional information: The username is not provided. Specify username in ClientCredentials.</p>
  
  <p>So I thought I could just set client.ClientCredentials to a new instance of NetworkCredentials.  However ClientCredentials is read only.  So how can I go about passing this information on to access the web service?</p>
  
  <pre><code>    myService.ServiceClient client = new myService.ServiceClient();
      // This won't work since its read only.                
      client.ClientCredentials = new System.Net.NetworkCredential("username", "password", "domain");
      string version = client.getData();
  </code></pre>
  
  <p>EDIT:
  Binding:</p>
  
  <pre><code>  &lt;binding name="VersionHttpBinding"&gt;
      &lt;security mode="TransportCredentialOnly"&gt;
        &lt;transport clientCredentialType="Basic" /&gt;
      &lt;/security&gt;
    &lt;/binding&gt;
  </code></pre>