title: Windows Authentication with basicHttpBinding of WCF
body: <p>I am quite annoyed with this one for last 2 hours :(</p>
  
  <p>Folks,</p>
  
  <p>I am trying to access a SharePoint OOTB List web service from a Console application. My SharePoint site in IIS is set to Integrated Windows Auth mode, and anonymous access is disabled.</p>
  
  <p>Now at client side what I am doing is as follows</p>
  
  <pre><code>try            
  {
     BasicHttpBinding bind = new BasicHttpBinding();
     bind.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
     bind.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
     EndpointAddress endpoint = new EndpointAddress("http://abc:37379/_vti_bin/lists.asmx");
     ServiceReference1.ListsSoapClient listService
         = new ConsoleApplication1.ServiceReference1.ListsSoapClient(bind, endpoint);
     var elm = listService.GetListItems("Tasks", null, null, null, "10", null, @"06dc3b48-a55e-4db8-8511-acbaf9748e15");
  }
  catch (Exception ex){
    Console.WriteLine("Message:\n" + ex.Message + "\nDetail:\n" +
    ex.ToString() + "\nStackTrace:\n" + ex.StackTrace);   }
  </code></pre>
  
  <p>Boom, this raises the exception "The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'NTLM'."</p>
  
  <p>I really wanted to do something like following what we used to do in old net 2.0 days</p>
  
  <pre><code>serviceProxy.Credentials = new NetworkCredentials("username","password","domain");
  </code></pre>
  
  <p>What is the easiest way to achieve this kind of credential handling in new proxy classes??</p>
  
  <p>(BTW as you have already noticed I am using the Binding /endpoint everything inside code rather a config file, this is a restriction for my app. please don't tell me to change this-its not possible).</p>
  
  <p>Can anyone help me with this?? It would be greatly appreciated.</p>