I have one method. You can even test it:
private readonly
public HtmlDocument Browse()
{
var _browser = new WebBrowser();
var link = "http://hotline.ua/sr/?q=allo";
var loadFinished = false;
_browser.DocumentCompleted += delegate { loadFinished = true; };
try
{
_browser.Navigate(link);
}
catch (Exception xx)
{
if (!(xx is UriFormatException))
throw;
loadFinished = false;
}
while ( ! loadFinished )
Thread.Sleep(50);
loadFinished = false;
return _browser.Document;
}
Then somewhere in code I call this method:
var doc = Browse();
Instead of getting a HtmlDocument I get to the infinite loop in :
while ( ! loadFinished )
Thread.Sleep(50);
It seems that DocumentCompleted is never fired. But in Web browser I can easily to get this page. Anybody knows why ? And what should I do to get a HtmlDocument ?