title: .ashx ASP.NET Handler Image not displayed in html img-element
body: <p>I have a strange problem.</p>
  
  <p>I created an ASP.NET Handler (AccidentMap.ashx) that gets a bitmap and returns it.</p>
  
  <p>Here is the handler:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Services;
  using System.Drawing;
  
  namespace BackOffice.Modules.Insurance_Company
  {
      /// &lt;summary&gt;
      /// Summary description for $codebehindclassname$
      /// &lt;/summary&gt;
      [WebService(Namespace = "http://tempuri.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      public class AccidentMap : IHttpHandler
      {
  
          public void ProcessRequest(HttpContext context)
          {
              try
              {
                  int id = Convert.ToInt32(context.Request.QueryString["ID"]);
  
                  System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser(context.User.Identity.Name);
  
  
                  InsuranceCompany.InsuranceCompany insuranceCompany = new InsuranceCompany.InsuranceCompany();
  
                  InsuranceCompany.Accident.Map map = insuranceCompany.GetMap(id, user.UserName, user.GetPassword());
  
                  Bitmap bitmap = map.Image;
  
  
                  System.IO.MemoryStream stream = new System.IO.MemoryStream();
                  byte[] bitmapBytes;
  
                  bitmap.Save(stream, bitmap.RawFormat);
                  bitmapBytes = stream.ToArray();
  
                  context.Response.ContentType = "image/jpeg";
                  context.Response.OutputStream.Write(bitmapBytes, 0, bitmapBytes.Length);
              }
              catch
              {
              }
          }
  
          public bool IsReusable
          {
              get
              {
                  return false;
              }
          }
      }
  }
  </code></pre>
  
  <p>It retrieves an image via the GetMap method.</p>
  
  <p>If I call this handler in the browser it displays the image:</p>
  
  <p>homepagepreisvergleich.de/img/internet/browser.JPG
  homepagepreisvergleich.de/img/internet/Property.JPG</p>
  
  <p>So obviously the ashx-handler returns an image.</p>
  
  <p>When I try to display the image within an html-page nothing is displayed.</p>
  
  <p>homepagepreisvergleich.de/img/internet/html.JPG</p>
  
  <p>Here is the html for the page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;img scr="http://localhost:1849/Modules/Insurance%20Company/AccidentMap.ashx?ID=129" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It is exactly the same url used in both scenarios.</p>
  
  <p>Has somebody got an idea what the reason for this strange behavior is and how to solve it?</p>
  
  <p>Greetings </p>
  
  <p>Alexander</p>