P
PrePort
The goal here is to return a dynamic image from an HttpHandler that I have
written. 2 questions
1. I am reading the images into byte[] fine and cacheing them fine, but what
should I use to deliver the image to the client?
My code:
context.Response.ContentType = "image/gif";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(DateTime.MinValue);
context.Response.BufferOutput = false;
context.Response.BinaryWrite(imageBytes);
or should the last line be:
context.Response.OutputStream.Write(imageBytes, 0, imageBytes.Length);
2. Should I do something like this:
context.Response.AddHeader("Content-Disposition","inline;filename=random.gif");
written. 2 questions
1. I am reading the images into byte[] fine and cacheing them fine, but what
should I use to deliver the image to the client?
My code:
context.Response.ContentType = "image/gif";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(DateTime.MinValue);
context.Response.BufferOutput = false;
context.Response.BinaryWrite(imageBytes);
or should the last line be:
context.Response.OutputStream.Write(imageBytes, 0, imageBytes.Length);
2. Should I do something like this:
context.Response.AddHeader("Content-Disposition","inline;filename=random.gif");