how to download image using html agility pack

c# html-agility-pack parsing xpath

Question

i have seen further question answers but cannot get a clear answer.

foreach (HtmlNode cat2 in doci.DocumentNode.SelectNodes(".//a/@href | //img/@src"))

in this i am getting src in img tag i want to download that image and store it into database.what should i do? is it possible with html agility pack to download image if so, then tell me how to get and assign it to a variable then i can store in my DB

var imagePath = cat2.Attributes["src"].Value;

this is not working too

Accepted Answer

The code you have write will only get the link of the image and u can save it in your DB and then make a client use that stored URL of the image and then u can download the image thanks



Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why