Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I want to download an image from a cartoon website. and my app is WinForm, not WebForm.

So let's say that there is an image on the a.html.

Normally, when I click the previous page and am redirected to this page, there will be a image :"image is loading", let's say A.jpg, in the same block.

After 5 seconds, the real one, let's say B.jpg, will be displayed.

So what I got is only the caching image rather than the one, B.jpg, which I want.

So..... how should I do it?

Thanks in advance.

I am using HtmlAgilePack to retrieve the html content.

//this url is about the whole html page
public static string getImageURL(string url)
        {
            string content1 = getPageContent(url);
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(content1);
            HtmlNode img = doc.DocumentNode.DescendantNodes().SingleOrDefault<HtmlNode>(x => x.Id.Equals("showImg"));
            string imgURL = img.GetAttributeValue("src", "");
            return imgURL;

}

by doing it in this way, I got imgURL = "/src/caching.gif"
but the real one is other thing.
Posted
Updated 18-Feb-11 10:28am
v4
Comments
aidin Tajadod 18-Feb-11 12:53pm    
your question is little unclear for me. what have you done? edit your question and put your code there. so we can help you better.
franva 18-Feb-11 13:48pm    
Ok I added the code. Hope it clearifies my question.
I'm looking forward to your solution. :)
aidin Tajadod 18-Feb-11 20:12pm    
OK, check the page, see if they change the image dynamically via js or somehting else after 5 seconds you mentioned before.
franva 18-Feb-11 22:00pm    
@aidin Tajadod, yes I did, when I use the HtmlAgilePack to retrieve that image url, it's scr/caching.gif after the image is loaded, the url will be replaced to the real one. Any idea?
aidin Tajadod 21-Feb-11 20:27pm    
Sorry Franva for my late answer,
So If you have access to your html, try to find out what is the second url. I know nothing about HtmlAgilePack, but I think it does not run scripts in your page! does it?
And also in your code, your are getting src of image tag. so obviously if some script change your image src dynamically you won't get it.

1 solution

Nobody knows the answer?????
>_<;;
 
Share this answer
 
Comments
fjdiewornncalwe 18-Feb-11 14:26pm    
I'm sure many do, but you have to be patient. There isn't a dedicated team of developers here to simply answer questions at your beck-and-call.
franva 18-Feb-11 22:00pm    
@Marcus Kramer, usually how long should I wait for a question? many thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900