Create a separate .aspx page, which doesn't have any HTML. In the code
behind you load the image into a memory stream and you stream that data
towards the browser by writing it into the response, setting the
appropriate headers. (so clear the headers first):

Response.ClearHeaders();
Response.AddHeader("Content-Type", "application/unknown");
Response.AddHeader("Content-Disposition");
Response.AddHeader("Content-Transfer-Encoding", "Binary");
Response.BinaryWrite(fileContents);

You then do in your normal webpage:
<!-- some html -->

<IMG SRC="myImageLoader.aspx?ImageID=343232">

and you then pass the image id to load to the page, I now used a
hardcoded number.

I'm not entirely sure about the mimetype I used here, I snipped a part
from a binary file streamer page, but the idea is the same.

        Frans.

--------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog : http://weblogs.asp.net/FBouma
Microsoft MVP (C#)
--------------------------------------------------------------------


> I have an SQL server table that contains an Image data type.
> 
> I want to read this Image into memory, and display it on an 
> ASPX web page.
> 
> I know how to read the image, and dump it to the users hard 
> drive (right now it gets created in the users WINNT/System32 
> folder, and not "TEMP").
> 
> I would like to completly bypass writing it to the disk, and 
> just display it in an ASPX page.
> 
> Thank you,
>   Bryan Clauss
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com 
> Some .NET courses you may be interested in:
> 
> 
> >>> Error in line 15 of ADVANCED-DOTNET.MAILTPL: unknown formatting 
> >>> command <<<
>  -> .NET Architecture and Design: Designing Distributed 
> Applications with <-
> 
> 
> 

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to