Reputation: 218722
I have an asp.net image control in one ASP.NET page and have a Memory Stream which has an image.How can i convert this memory stream to set it as the image source without storing the image in the hard disk ?
Upvotes: 2
Views: 4089
Reputation: 498992
The image control takes an ImageUrl
- a path to where the image is located.
There is no property that takes an actual image (or image data).
What you can do is write a HttpHandler
that will stream your images from whatever source - set the ImageUrl
to use this handler.
Here is an example for a general file handler using a memory stream - it's a good starting point for what I suggest.
Upvotes: 3
Reputation: 10211
you'll have to either write that file onto disk or make another page (action on the same page?) that writes the content of your MemoryStream into the Response, and then point the image control to that source.
Upvotes: 1