title: Not understanding why WinHTTP does NOT authenticate certain HTTPS resource
body: <p>I'd be extremely grateful for any kind of help that may help me resolving the problem.</p>
  
  <p>From Excel VBA code I need to download &amp; parse CSV file from HTTPS site <a href="https://redmine.itransition.com/" rel="nofollow">https://redmine.itransition.com/</a>. I try to use WinHTTP to get the file. However, I can't understand why authentication does not work. Here is the piece of related code:</p>
  
  <pre><code>TargetURL = "https://redmine.itransition.com/projects/pmct/time_entries.csv"
  Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
  HTTPReq.Option(4) = 13056 ' WinHttpRequestOption_SslErrorIgnoreFlags 13056: ignore all err, 0: accept no err
  HTTPReq.Open "GET", TargetURL, False
  HTTPReq.SetCredentials "UN", "PW", 0
  HTTPReq.send
  </code></pre>
  
  <p>returns the following response (only certain strings are listed):</p>
  
  <pre><code>Content-Type: text/html; charset=utf-8
  Status: 406
  X-Runtime: 5
  </code></pre>
  
  <p>However, if I send "Cookie" string from Firefox cookie after successful manual authentication using</p>
  
  <pre><code>HTTPReq.setRequestHeader "Cookie", SetCookieString
  HTTPReq.send
  </code></pre>
  
  <p>I easily get the expected file. Of course I'm not happy with such solution, and want to perform true WinHTTP authentication. However, I can't understand what's wrong or what I miss in my code. Most likely I have to use <code>.SetClientCertificate</code> method, but this is unclear for me - which cert is required?</p>
  
  <p>Or, being more general: which WinHTTP methods or functions I should use for debugging to find out which step is blocking / incorrect and prevents me from correct authentication? I spent 2 weeks seeking through MSDN and various resources, but still have no solution.</p>
  
  <p>Thanks in advance for your suggestions!</p>