0

I would like to download an image from external site using C#. The problem is image's source is generated on the server side using ajax and is not available from source code of the page. The JavaScript function which is called to generate image's source looks like this:

xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState==4)
    {
    document.searchform.xpic.src=xmlHttp.responseText;
    }
  }

xmlHttp is instanced earlier:

xmlHttp=new XMLHttpRequest();

So is it possible to initiate the call of JavaScript function and get source of the image? Could you please tell me how to do it?

1 Answer 1

1

You could inspect the URL by which the above request is made and replicate the same request from your C# code to get the URL of the images. Its much easier to go on about the problem this way than looking at executing JavaScript within the C# environment.

Sign up to request clarification or add additional context in comments.

1 Comment

The source of the image changes every time you load the page. So you can't know the exact url without execution script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.