tags:

views:

32

answers:

1

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  A: 

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.

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