title: Web Service 401: Unauthorized Error
body: <p>I am running a web service locally that connects to an outside server that i do not have access to.</p>
  
  <p>I keep receiving the "401: Unauthorized" error even though the test credentials are confirmed exactly correct by the admins of this web service.</p>
  
  <p>Do i need to adjust any IIS settings?</p>
  
  <p>Here is a screenshot of the error.</p>
  
  <p><img src="https://i.stack.imgur.com/tlZct.jpg" alt="enter image description here"></p>
  
  <pre><code>        // Webservice
          IdentityService ws = new IdentityService();
  
          // Test Static Credentials
          string username = "twfnf";
          string password = "testme99";
          string domain = "testapps1";
  
          NetworkCredential credentials = new NetworkCredential(username, password, domain);
  
          CredentialCache credCache = new CredentialCache();
          credCache.Add(new Uri(ws.Url), "Basic", credentials);
  
          ws.Credentials = credCache;
          ws.PreAuthenticate = true;
          ws.AuthenticateUser();
  </code></pre>