I am reading the image from a database and writing into a file, No problem
there. I just cannot get the ImageURL to point to the right folder.
How do you stream the file into the web itself ? Where can I find out how ?
If I understand correctly, you simply don't need to write a file. What
I would do is in my page html (from aspx) page, refer to an image
(that doesn't exist) [see later], and then use a handler (e.g. ashx)
to serve the image. A handler is broadly just a fancy name for a class
that responds to requests, often much simpler than a full-blown aspx.
All it needs to do is:
* set the content-type so that the browser knows if it an image (and
what type)
* write the raw image to the response-stream
The latter is identical to working with a FileStream. The "handler"
step can be done in 2 ways; you can add a handler via the IDE and get
an .ashx file (with a query-string such as my.ashx?id=12345);
alternatively you can do the same without the actual ashx file, by
editing the httpHandlers section of web.config (you can then make the
URL look tidier, such as 12345.gif). Either way, the first thing your
handler has to do is to parse the URL to find which image to serve,
and fetch the binary.
A similar example:
http://weblogs.asp.net/cazzu/archive.../27/25568.aspx
A good overview of handlers:
http://msdn2.microsoft.com/en-us/library/ms972953.aspx
Marc