Image src not displaying external image served by handler
<p>I have a handler that serves images from a external website. This works absolutely fine on its own.</p>

<p>But when I use the handler in an image src attribute it doesn't work. </p>

<p>This is the call I make to the handler:</p>

<pre><code>&lt;img src="myhandler.ashx?image=http://nssdc.gsfc.nasa.gov/image/planetary/venus/gal_venus_37218.jpg" / &gt;
</code></pre>

<p>This is the code for the handler:</p>

<pre><code>using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Drawing;
using System.Net;
using System.IO;
using System.Drawing.Imaging;

namespace MumsChoice.Portal.UI.Handlers
{
    /// &lt;summary&gt;
    /// Summary description for $codebehindclassname$
    /// &lt;/summary&gt;
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ExternalImageHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            Bitmap bitOutput = null;
            Stream stream = null;
            string contentType = string.Empty;
            try
            {
                WebRequest req = WebRequest.Create(context.Request.QueryString["image"]);
                WebResponse response = req.GetResponse();
                contentType = response.ContentType;
                stream = response.GetResponseStream();
                bitOutput = new Bitmap(stream);
            }
            catch
            {
                bitOutput.Dispose();
            }
            finally
            {
                stream.Close();
                stream.Dispose();
                stream = null;
            }

            ImageFormat format;
            switch (contentType)
            {
                case "image/png":
                    format = ImageFormat.Png;
                    break;
                case "image/gif":
                    format = ImageFormat.Gif;
                    break;
                default:
                    format = ImageFormat.Jpeg;
                    break;
            }

            context.Response.ContentType = contentType;
            bitOutput.Save(context.Response.OutputStream, format);
            bitOutput.Dispose();
            return;  
        }


        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
</code></pre>

<p>Any idea why?</p>
