Send Image as http response
I am downloading bytes from a URL link ( which is a link to pdf file)
WebClient imageWebClient = new WebClient();
response.Image = imageWebClient.DownloadData(Url);
for other images types I am doing following, I am not sure how am I supposed to show this image which is extracted from a pdf file.
context.Response.AddHeader("Content-Disposition",开发者_JS百科 "inline; filename=image.jpg");
context.Response.ContentType = "image/jpeg";
streamBitmap = new MemoryStream(response.Image); //GetBitMapStreamFromData(CheckImg.ImageData);
if (streamBitmap != null)
{
streamBitmap.WriteTo(context.Response.OutputStream);
}
This doesn't work for bytes received by above code from a pdf link.
精彩评论