Assign image from file stream

  • Thread starter Thread starter saetiagous
  • Start date Start date
S

saetiagous

Hello,

I have a file stream, which retreives an image from my database and
holds in its temp. 'hand'.

How do i put this into an Image object on my asp.net webpage???

PLease help someone, driving me crazy!!!
Tiago
 
Tiago,

Probably the cleanest way to do it without creating a file in a virtual
directory is to stream it down to the client using an IHttpHandler. There's
a simple of example of how to do this in the "Personal Web Site Starter Kit"
located at:
http://msdn2.microsoft.com/en-us/vstudio/aa718342.aspx#VWD

The handler sets the Mime type to "image/jpeg" and does a
Response.OutputStream.Write(). In your aspx you reference the handler by
"<img src="Handler.ashx?AlbumID=<%# Eval("PictId")" %> />"

hth,
Jason Vermillion
 
Back
Top