C# Web Client : Cannot load the image in html when load the web page
<p>I am trying to load the html content using c# (To simulate php function - file_get_contents) using the following codes:</p>

<pre><code>protected string file_get_contents(string fileName) 
{ 
  string sContents = string.Empty; 
  if (fileName.ToLower().IndexOf("http:") &gt; -1) 
  { // URL 
   System.Net.WebClient wc = new System.Net.WebClient(); 
   byte[] response = wc.DownloadData(fileName); 
   sContents = System.Text.Encoding.ASCII.GetString(response); 
  } else { 
   // Regular Filename 
   System.IO.StreamReader sr = new System.IO.StreamReader(fileName); 
   sContents = sr.ReadToEnd(); 
   sr.Close(); 
  } 
 return sContents;
}
</code></pre>

<p>However, this does not load the image in the html when rendering the content. But when use PHP file_get_content, it does load the image in the html when rendering the content.</p>

<p>Anyone has any idea?</p>
