Handler to write image from DB not working IE7
-
I have an .ashx file that loads an image (specified by id in querystring) and then writes it out to the client. This works perfectly in Firefox, but all I get is a red X in IE7 (I have no way to test IE6). Here is the method:
public void ProcessRequest(HttpContext context) { int contribId = Convert.ToInt32(context.Request.QueryString["id"]); byte[] buffer = Contributor.GetImage(contribId); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(buffer); }
Any idea what is wrong with this? -
I have an .ashx file that loads an image (specified by id in querystring) and then writes it out to the client. This works perfectly in Firefox, but all I get is a red X in IE7 (I have no way to test IE6). Here is the method:
public void ProcessRequest(HttpContext context) { int contribId = Convert.ToInt32(context.Request.QueryString["id"]); byte[] buffer = Contributor.GetImage(contribId); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(buffer); }
Any idea what is wrong with this?you could try public void ProcessRequest(HttpContext context) { int contribId = Convert.ToInt32(context.Request.QueryString["id"]); byte[] buffer = Contributor.GetImage(contribId); context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(buffer); context.Response.End; }
I didn't get any requirements for the signature
-
you could try public void ProcessRequest(HttpContext context) { int contribId = Convert.ToInt32(context.Request.QueryString["id"]); byte[] buffer = Contributor.GetImage(contribId); context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(buffer); context.Response.End; }
I didn't get any requirements for the signature
Ok, so come to discover that there was some issue with the image itself and Firefox could display it, but IE could not. Thanks for you suggestion though.