0
我正在向請求NTLM
認證的服務器發送GET
請求。使用HttpClient設置CachePolicy後未經授權的響應
爲此,我們設置UseDefaultCredentials = true
var defaultHandler = new WebRequestHandler
{
UseDefaultCredentials = true,
CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore),
AutomaticDecompression = DecompressionMethods.GZip,
AllowAutoRedirect = true,
UseCookies = true,
CookieContainer = new CookieContainer()
};
一切都正常工作,直到我們決定打開緩存。
爲此,我們改變了我們的CachePolicy
到CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default)
與該改變的服務器開始與401 - unauthorized
迴應並正在發送旁邊的WWW-Authenticate: NTLM
任何想法,爲什麼設置緩存改變行爲?