title: Disable Windows Authentication for WebAPI
body: <p>I am playing with an MVC4 application and using WebAPI for fetching/sending all my data. In a controller I am using an HttpClient request to get the data and all is working fine. The issue I am facing is that when Windows authentication is enabled in the project, the web API calls are returning a 401 Unauthorized error. </p>
  
  <p>the code in my controller that does the calling is:</p>
  
  <pre><code>using (var client = new HttpClient())
  {
      var invoiceDetailUrl = BASE_URL + Url.HttpRouteUrl(
          "DefaultApi",
          new { controller = "InvoiceDetails", id = id }
       );
  
       var result = client.GetAsync(invoiceDetailUrl).Result; 
  
   }
  </code></pre>
  
  <p>Windows authentication has to be on for the site, but not necessarily the Web API controllers.  I have tried excluding the API controllers in the web.config like below:</p>
  
  <pre><code>&lt;location path="api"&gt;
          &lt;system.web&gt;
              &lt;authorization&gt;
                  &lt;allow users="*"/&gt;
          &lt;/authorization&gt;
      &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>but the additions to the web.config did nothing.</p>
  
  <p>Any suggestions?</p>