K
Ken Varn
I am using an HttpModule handler to dynamically stream out a JPEG image to
an <img> control. It seems to work fine except for one thing. If I try to
save the image in IE using the "Save Picture..." selection, IE does not
recognize that the image is a JPEG. Instead, it tries to save it as a BMP.
Is there something that I need to send in the response header to make IE
recognize that the image is a JPEG? I am hoping that the ASPX extension is
not what is throwing it off.
Here is a snippet of what I am doing.
HTML
<img src="MyVirtualUrl.aspx">
C# Server Side.
MemoryStream MemStream = new MemoryStream();
//
// ImgData is built in here as a Byte[] array. Details omitted
for space.
//
MemStream.Write(ImgData.Data,0,ImgData.Data.Length);
MemStream.WriteTo(context.Response.OutputStream);
MemStream.Close();
context.Response.Cache.SetNoServerCaching();
context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(new
DateTime(1900,01,01,00,00,00,00));
context.ClearError();
context.Response.ContentType = "image/JPEG";
context.Response.StatusCode = 200;
context.Response.Flush();
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
an <img> control. It seems to work fine except for one thing. If I try to
save the image in IE using the "Save Picture..." selection, IE does not
recognize that the image is a JPEG. Instead, it tries to save it as a BMP.
Is there something that I need to send in the response header to make IE
recognize that the image is a JPEG? I am hoping that the ASPX extension is
not what is throwing it off.
Here is a snippet of what I am doing.
HTML
<img src="MyVirtualUrl.aspx">
C# Server Side.
MemoryStream MemStream = new MemoryStream();
//
// ImgData is built in here as a Byte[] array. Details omitted
for space.
//
MemStream.Write(ImgData.Data,0,ImgData.Data.Length);
MemStream.WriteTo(context.Response.OutputStream);
MemStream.Close();
context.Response.Cache.SetNoServerCaching();
context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(new
DateTime(1900,01,01,00,00,00,00));
context.ClearError();
context.Response.ContentType = "image/JPEG";
context.Response.StatusCode = 200;
context.Response.Flush();
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------