title: Firefox NTLM Credentials to localhost
body: <p>I'm trying to setup a WebAPI web service and website that will operate on our company intranet. I'm using IIS to host the webservice (A) as well as my website (B). A page on my website makes a request to the web service thusly:</p>
  
  <pre><code>var URL = 'http://MachineName:80/AWebService/api/GetGuid';
  var request = new XMLHttpRequest();
  request.open("GET", URL, false);
  request.withCredentials = "true";
  request.send();
  var response = request.responseText;
  return response;
  </code></pre>
  
  <p>The WebService code looks like this:</p>
  
  <pre><code>[EnableCors(origins: "http://localhost", headers: "*", methods: "*")]
  public class StoneSoupController : ApiController
  {
      [ActionName("GetGuid")]
      public HttpResponseMessage GetGuid()
      {
          var indenty = this.User.Identity;
          Guid g = Guid.NewGuid();
  
          HttpResponseMessage msg = new HttpResponseMessage();
          msg.Content = new StringContent(g.ToString());
          msg.Headers.Add("Access-Control-Allow-Origin", "http://localhost"); //tried with and without this
          msg.Headers.Add("Access-Control-Allow-Credentials", "true"); //tried with and without this
          return msg;
  
      }
  }
  </code></pre>
  
  <p>If I set the Authentication mode in IIS for the web service to Anonymous Authentication then the web service returns the guid string as expected. However I need to control which users are able to access certain methods on the webservice and want to use their windows credentials to do this.</p>
  
  <p>My problem is that I can't seem to make Firefox send the windows credentials. I've tried including <code>http://localhost</code> in <code>network.automatic-ntlm-auth.trusted-uris</code> in <code>about-config</code> in Firefox, but that doesn't seem to have any effect.</p>
  
  <p>I've enabled logging in IIS and this is what it records for the request</p>
  
  <pre><code>2013-08-01 21:36:05 136.203.40.232 GET /AWebService/api/GetGuid - 80 - 136.203.40.232 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:17.0)+Gecko/20100101+Firefox/17.0 200 0 0 965
  </code></pre>
  
  <p>As you can see there's no user id in the transaction.</p>
  
  <p>Can anyone help me with this?</p>