You can create an ASPX page that will return an image file as an array of bytes with the corresponding header information, to get the image, you can call this page, for example imagemanager.aspx?imgid=31337
Then, on the main page in, system.web.ui.webcontrols.imageset the ImageUrlproperty set to your script path:
ctrlImage.ImageUrl = "imagemanager.aspx?imgid=31337";
Here is an example method for displaying an image in imagemanager.aspx:
private void TransmitBytes(byte[] bytes, string outFileName)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + outFileName);
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.ContentType = "image/jpeg";
Response.BinaryWrite(bytes);
Response.End();
}
source
share