title: What is the quickest way to stream an image from a FILESTREAM in SQL to a browser?
body: <p>I have images stored in my database in a FILESTREAM and I am trying to find out what the best solution is to get that image back out into a web browser.</p>
  
  <p>If I was managing the files on the file system myself, the quickest way would just be:</p>
  
  <pre><code>Response.TransmitFile(pathToFile);
  </code></pre>
  
  <p>This does not load the file into memory before transmitting it back to the client (to my understanding) and as such is nice and speedy.</p>
  
  <p>I'm currently using Linq to SQL to get the FILESTREAM. This provides the FILESTREAM as a Binary object.</p>
  
  <p>So far have this quite ugly way of doing it:</p>
  
  <pre><code>Response.WriteBinary(fileStreamBinary.ToArray());
  </code></pre>
  
  <p>Am I going to be better off not bothering with the Linq to SQL and doing things more directly?</p>
  
  <p>I'm beginning to wonder why I bothered with FILESTREAM in the first place and didn't just stick to managing the files myself. I'm sure there was a reason for it without using the word "bandwagon"!</p>