特定の Web サイトに httpwebrequest を送信していて、その Web サイトからの画像が必要ですが、この画像はリクエストが完了してから 3 ~ 5 秒で読み込まれるため、ソースに画像が含まれていないため、何らかの遅延を発生させたいと考えています。数秒後に応答を取得できます。これが私のコードです。
HttpWebRequest req1 = (HttpWebRequest)WebRequest.Create("url");
using(var httpResponse = req1.GetResponse())
{
using (var ResponseStream = httpResponse.GetResponseStream())
{
if (ResponseStream != null)
{
using (StreamReader sr = new StreamReader(ResponseStream))
{
string response = sr.ReadToEnd();
var doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(ResponseStream);
foreach(HtmlNode node in doc.DocumentNode.SelectNodes("src"))//it's not working because the source does not contain the image
{
pictureBox1.ImageLocation = node.ToString();
}
}
}
}
}