title: How do I integrate C# Web API BasicAuthentication with IIS?
body: <p>I currently have a working C#/ASP.NET Web API program which goes through BasicAuthentication (I sent the username and passwords through HTTP Response Headers when making the HTTP Request to the Web API) to authorize users that are trying to access the API. However, when I tried to host the Web API on IIS, the Web API's BasicAuthentication gets messed up and does not trigger. </p>
  
  <p>Currently, I hosted my Web API on the IIS and it appeared in my IIS Manager (Under Default Web Site, as a Application) and for authentication, the "Anonymous Authentication" is enabled, and "ASP.NET Impersonation + Forms Authentication" are disabled.</p>
  
  <p>Is there anything I can do to allow my Web API's BasicAuthentication through IIS?</p>
  
  <p>Edit: I have a Authorization Filter in my WebApiConfig.cs</p>
  
  <p><code>config.Filters.Add(new BasicAuthenticationAttribute());</code></p>
  
  <p>Edit: Codes used for authentication</p>
  
  <pre><code> client.DefaultRequestHeaders.Add("Authorization", "BASIC " + encode);
  
   var postTask = client.PostAsJsonAsync&lt;string&gt;("values?reason=postauth", "PostAuth");
   postTask.Wait();    
   var result = postTask.Result;
   string resultStr = postTask.Result.ReasonPhrase.ToString();
  </code></pre>
  
  <p>The string resultStr returns "Internal Server Error".</p>