title: How do I get a C# WebBrowser control to show jpeg files (raw)?
body: <p>Does anyone know in .Net 2.0 - .Net 3.5 how to load a jpeg into a System.Windows.Forms.WebControl as a byte-array and with the right mimetypes set so it will show?</p>
  
  <p>Something like:<br></p>
  
  <pre><code>webBrowser1.DocumentStream = new MemoryStream(File.ReadAllBytes("mypic.jpg"));
  webBrowser1.DocumentType = "application/jpeg";
  </code></pre>
  
  <p>The webBrowser1.DocumentType seems to be read only, so I do not know how to do this. In general I want to be able to load any kind of filesource with a mimetype defined into the browser to show it.</p>
  
  <p>Solutions with writing temp files are not good ones. Currently I have solved it with having a little local webserver socket listener that delivers the jpeg I ask for with the right mimetype.</p>
  
  <p>UPDATE: Since someone deleted a answer-my-own question where I had info that others could use, I will add it as an update instead. (to those who delete that way, please update the questions with the important info).</p>
  
  <p>Sample solution in C# here that works perfectly: <a href="http://www.codeproject.com/KB/aspnet/AspxProtocol.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/AspxProtocol.aspx</a></p>