public void Image(int id, ImageSize size) { byte[] image = productionService.GetImage(id, size); if (image != null && image.Length > 0) { Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-length", image.Length.ToString()); Response.ContentType = "image/jpeg"; Response.BinaryWrite(image); Response.Flush(); } else { throw new HttpException(404, "The image could not be found"); } }