public void HttpsRequest(string address)
{
string data;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
byte[] resp = new byte[(int)response.ContentLength];
Stream receiveStream = response.GetResponseStream();
using (StreamReader reader = new StreamReader(receiveStream, Encoding.ASCII))
{
data = reader.ReadToEnd();
}
}
https 経由でページを読み込もうとすると、算術演算でオーバーフローが発生します。応答で ContentLenght = -1 が返されるため、エラーが発生します。fiddler を使用すると、ページが受信されたことがわかります。HTTPS を使用する他の Web サイトの一部は正常に動作しますが、ほとんどの Web サイトは正常に動作しません。