title: ASP.NET Handler not working properly
body: <p>I created an Ashx handler in C# that serves me up images based on a <code>fileid</code> parameter that gets passed on to me. I also have a simple tooltip preview script that I wrote, which is not working. You can see the image loading, but then after it loads, the image just vanishes.</p>
  
  <p>I suspect the issue is in the ASHX handler because if I use a static image, it works just fine. Here is my ASHX handler code:</p>
  
  <pre><code>    public void ProcessRequest(HttpContext context)
      {
          string fileId = HttpUtility.UrlDecode(context.Request.QueryString["fileId"] ?? "") ?? "";
          string fullFileName = context.Server.MapPath("~/Uploads") + "\\" + fileId;
  
          using (FileStream s = File.Open(fullFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
          {
              context.Response.ContentType = HelperClasses.Utility.GetMimeTypeFromMagic(fullFileName);
  
              var buffer = new byte[s.Length];
              s.Read(buffer, 0, (int) s.Length);
  
              context.Response.BinaryWrite(buffer);
              context.Response.Write(buffer);
  
              s.Close();
          }
          context.Response.Flush();
          context.Response.Close();
      }
  </code></pre>
  
  <p>In addition, I've created <a href="http://jsfiddle.net/543qbx71/" rel="nofollow">a fiddle</a> to demonstrate the issue.</p>