dynamics nav webservice error 401 Unauthorized
<p>When consuming a dynamics nav web service I get the following error :</p>

<blockquote>
  <p>The request failed with HTTP status 401: Unauthorized.</p>
</blockquote>

<p>However when I try it in a browser it works . I tried the following but its still not working :</p>

<pre><code>service.UseDefaultCredentials = true;
service.PreAuthenticate = true;
</code></pre>

<p>also :</p>

<pre><code>service.Credentials = new System.Net.NetworkCredential("XXXXX", "XXXX","XXXX");
</code></pre>

<p>I even tried using dynamics nav acces key but also it didn't work.</p>

<p>Any new suggestions ?</p>