I am trying to retrieve images on the page using mshtml. Working on 2 different machines (both Win7-64 bit) gives me different results. One of the machines works just fine. The second one, though, is unable to read the width/height attribute of images. All the heights/width are zeros.
public JsonResult GetHtml(string url)
{
var client = new WebClient();
var htmlCode = client.DownloadString(url);
var htmlDocument = new mshtml.HTMLDocument() as mshtml.IHTMLDocument2;
htmlDocument.write(htmlCode);
var htmlImages = htmlDocument.body.all.tags("img");
var listImages = new List<HtmlImage>();
foreach (var htmlImage in htmlImages)
{
Console.Out.WriteLine("Src: {0}", htmlImage.src);
Console.Out.WriteLine("Width: {0}", htmlImage.width);
Console.Out.WriteLine("Height: {0}", htmlImage.height);
}
}
The machine that works fine uses MSDN Visual Studio 2010. The machine that does not give me the correct results uses Visual Studio Express Edition 2010.
I will really appreciate any help: how can I get the size of the image on both machines?