In C# how do I get the full URL from HTMLImgClass?
I am writing a program to download images from a web page. Â I am able to download the images, but I would also like to log the full path of where it came from.
Below is the code that I have written.
WebBrowser scrapeWebBrowser = new WebBrowser(); scrapeWebBrowser.Navigate("http://yahoo.com"); HTMLDocument objHtmlDocument = (HTMLDocument)scrapeWebBrowser.Document; foreach (HTMLImgClass imageElement in objHtmlDocument.images) { //HTMLImage WebClient client = new WebClient(); string fileName = System.IO.Path.GetFileName(imageElement.href); client.DownloadFileAsync(new Uri(imageElement.href), System.IO.Path.Combine(@"L:\temp\imagedownload\", fileName)); //How do I get the full url for imageElement? }