I have an Image stored in my SQL Server database stored with my User data which I retrieve all at once.
Now I have the byte[] directly on the page I want to show it on. How do I put it in my WebControls.Image? I don't want to have to call an HttpHandler and call the database again.
This obviously just outputs it to the whole page.
Context.Response.BinaryWrite(user.Picture.ToArray());
If it is a small image you would output it as base64 encoded data into an image-tag. See here for a similar situation.
But in 99.9% of all situations you would create a HttpHandler that returns the image. It is the easiest and fastest way to do it I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With