title: C# and Internet Explorer automation, accessing the cache
body: <p>I have an Internet Explorer automation script in c#, it works ok but I want to access a captcha image the captcha link returns a refreshed image every time it is visited, and since the browser has already visited it once visiting it again would mess things up, so I tried to find the image in the browsers cache on the disk with the following code</p>
  
  <pre><code>tempDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).ToString();
  System.Console.WriteLine(tempDir);
  supstra = element.innerHTML.ToString().Substring(element.innerHTML.ToString().IndexOf("/sorry/image?id="), element.innerHTML.ToString().Length - element.innerHTML.ToString().IndexOf("/sorry/image?id="));
  Console.WriteLine("http://www.goolge.com/sorry/image?id=" + element.innerHTML.ToString().Substring(element.innerHTML.ToString().IndexOf("/sorry/image?id="), supstra.IndexOf("&amp;amp;hl=")));
  captchas = client.Decode(tempDir + "\\" + element.innerHTML.ToString().Substring(element.innerHTML.ToString().IndexOf("/sorry/image?id=") + 7, supstra.IndexOf("&amp;amp;hl=")).Replace("amp;", "") + "=en", 0);
  </code></pre>
  
  <p>The image however in the cache directory is not an image but a command or something with the name <code>image?id=....</code></p>
  
  <p>and all it does is revisit and get new image. What do I have to do it seems is to somehow access the image the browser is showing, which might be only in the memory, how can I do that?</p>