2
我有一個需要基本身份驗證標頭的web服務。然而,當我把它用重定向基本身份驗證
var header = "Authorization: Basic " +
CreateBasicHttpAuthenticationHeader(login, password);
webRequest.Headers.Add(header);
var webResponse = (HttpWebResponse)webRequest.GetResponse();
它返回一個303 - 參見其他:
POST https://myservice/rates HTTP/1.1
Authorization: Basic QXZ...NjY=
Content-Type: application/x-content
X-API-Version: 1.1
If-Unmodified-Since: Mon, 23 Sep 2013 08:32:27 GMT
User-Agent: UserAgent
響應:
HTTP/1.1 303 See Other
Date: Mon, 23 Sep 2013 08:30:57 GMT
X-Opaque-ID: q8nxxxxc
Location: https://myservice/rates
Content-Length: 0
淨,然後自動發送一個GET請求到新位置:
GET https://myservice/rates HTTP/1.1
Content-Type: application/x-content
X-API-Version: 1.1
If-Unmodified-Since: Mon, 23 Sep 2013 08:32:27 GMT
User-Agent: UserAgent
但是此次不會發送授權標題。你知道一種方法來告訴它發送所有呼叫的所有標題嗎?我應該告訴它不要遵循內容?