I am sending a GET
request to a server which expects NTLM
authentication.
For that we set UseDefaultCredentials = true
var defaultHandler = new WebRequestHandler
{
UseDefaultCredentials = true,
CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore),
AutomaticDecompression = DecompressionMethods.GZip,
AllowAutoRedirect = true,
UseCookies = true,
CookieContainer = new CookieContainer()
};
Everything was working correctly until we decided to turn on Cache.
For that we changed our CachePolicy
to CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default)
With that change the server started to respond with 401 - unauthorized
and is sending alongside the WWW-Authenticate: NTLM
Any ideas why setting the Cache changed the behavior?