title: SharePoint 2013 unauthorized error c# console application
body: <p>I can access a SharePoint site on my company network via a browser passing in specific username and password however when I try to access the same site via my console application I get a 401 Unauthorized error.</p>
  
  <p>I cannot use windows authentication for the logged in user due to the way our SharePoint security is set up and I have no control to change its settings.</p>
  
  <p>Can anyone help me spot the issue?</p>
  
  <pre><code>WebRequest request = WebRequest.Create(doc.DocumentUrl);
  request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
  request.Credentials = new NetworkCredential(spUser.username, spUser.Pwd, spUser.domain);
  WebResponse response = request.GetResponse();  
  </code></pre>