title: How to make browsers to display image which is written to client in binary form?
body: <p>In ASP file, I read and output a image in binary form.</p>
  
  <p>I want browsers to display the image, not download. </p>
  
  <p>I have known that the header <code>Content-Disposition</code> should be <code>inline</code>.</p>
  
  <p>But I can't determine what <code>Content-Type</code> should be used, because I can't make sure which format the image will be.</p>
  
  <p>I know that <code>image/png</code> workes for png and jpg in chrome, but I am not sure whether <code>image/png</code> will be fit for all formats of image all the time.</p>
  
  <pre><code>'lngFileLength is the size of image
  Response.AddHeader "Content-Length", lngFileLength
  Response.ContentType = "image/png"
  Response.AddHeader "Content-Disposition", "inline"
  'rst1(strImageField).Value is the image in binary form
  Response.BinaryWrite rst1(strImageField).Value
  </code></pre>
  
  <p>Thanks for any help.</p>
  
  <p>EDIT: I don't think my question is duplicate of <a href="https://stackoverflow.com/questions/48273269/how-to-make-browsers-to-display-image-which-is-written-to-client-in-binary-form">PHP : binary image data, checking the image type</a> ,because my question is "display image inside browser", not "check image type". </p>
  
  <p>The best solution I wish is that we can tell browser to display, not download, image by setting header or other way. </p>
  
  <p>Although "check image type" can solve this problem, it is the answer, not the question.</p>