How to pass default credentials in Windows Authentication
<p>I'm developing UWP application using C#.net and it has WCF service with Windows Authentication enabled. I struggling to pass default NetworkCredential after consume a service call using Add service reference option.</p>

<p>Please find below my examinations.</p>

<p>When I pass correct windows authentication credentials, it is working as expected.</p>

<pre><code>var service = new ServiceReference.Service1Client();
service.ClientCredentials.Windows.ClientCredential =new NetworkCredential("pradeep","****");
var test = await service.GetDataAsync(1);
</code></pre>

<p>but, I wanted pass default network credentials while using my service methis</p>

<pre><code>var service = new ServiceReference.Service1Client();
service.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
var test = await service.GetDataAsync(1);
</code></pre>

<p>I also tried below option.</p>

<pre><code>service.ClientCredentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
</code></pre>

<p>When I pass default credentials. I'm getting below exception.</p>

<blockquote>
  <p>The HTTP request is unauthorized with client authentication scheme
  'Negotiate'. The authentication header received from the server was
  'Negotiate, NTLM'.</p>
</blockquote>

<p>I tested same service call with default NetworkCredential in WPF application which is working as expected.</p>