Image Problems

B

BluDog

Hi

I have a class that has a System.Drawing.Image as a property, i would
like to display this image on my WebForm, however i think i need to
get it into a System.Web.UI.WebControls.Image object, but i cannot
work out how do conver it.

Any ideas?

Thanks

blu
 
K

Kevin Spencer

No, you don't want to get it into a System.Web.UI.webControls.Image object.
All that does is render HTML for an image in the page. It doesn't create an
image and stream it to the client. What you need to do is to create an ASPX
page that will serve as the image itself. This is done by setting the
Response.ContentType to "image/jpg" (or whatever image type), and streaming
the image back to the browser.

Images in an HTML document are links/references to the URLs for the image
resources that they link to. When the browser encounters an <img
src="someurl"> tag, it creates an HTTP Request for that resource, which it
receives, and then lays out in the page. So, an HTML document is not
necessarily a single Request from the browser, but as many Requests as there
are separate resources in the document.

In the ASPX page which renders the image, you would put a regular image tag
in, with the URL pointing to the ASPX page that delivers the image. Example:

<img src="Images.aspx">

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top