Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Show Inline BitMap in ASPX Page?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
coconet - 04 Feb 2008 21:15 GMT
I have an ASP.NET 3.5 web application (VS2008) and have a class that
generates a BitMap. I would like to show this as an image inline on an
existing ASP.NET page (showing as an <img> or an <a> image hyperlink).

Thanks.
Mark Fitzpatrick - 04 Feb 2008 22:37 GMT
You don't dump the image directly into the page. What you do is create a
second page that has absolutely no HTML content in the designer. Then in
code behind you can create an image and then dump it to the
response.outputstream. Then in your page with the <img> tag, you point the
source for that image to the new page you just created. To the browser it
appears as if that other file is just another image since it's getting back
a valid image.

Keep in mind though, standard bitmap BMP's aren't really browser friendly.
Some browsers don't support them, and the resultant BMPs are often huge when
compared to other formats such as jpg or png.

Signature

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

> I have an ASP.NET 3.5 web application (VS2008) and have a class that
> generates a BitMap. I would like to show this as an image inline on an
> existing ASP.NET page (showing as an <img> or an <a> image hyperlink).
>
> Thanks.
Michael Nemtsev - 04 Feb 2008 23:33 GMT
I think the best option is to create IHttpHandler where you will create your
images with your class.

After that you can generate all images in your pages via image handler.

google by "asp.net ihttphanlder image" to find samples

Signature

WBR,  Michael  Nemtsev [.NET/C# MVP].  
Blog: http://spaces.live.com/laflour

> I have an ASP.NET 3.5 web application (VS2008) and have a class that
> generates a BitMap. I would like to show this as an image inline on an
> existing ASP.NET page (showing as an <img> or an <a> image hyperlink).
>
> Thanks.
coconet - 05 Feb 2008 15:22 GMT
The problem with the IHttpHandler is that I cannot install things into
IIS or make changes to script mappings or etc. I have to have a "pure
xcopy" solution. Even if there is a speed penalty, I would like to
have an image-emitting class that creates a JPG that I can just put
into a page from a codebehind.

I am looking around on the web for more ideas, but all input here is
preferred and appreciated. :)

Thanks.

>I think the best option is to create IHttpHandler where you will create your
>images with your class.
>
>After that you can generate all images in your pages via image handler.
>
>google by "asp.net ihttphanlder image" to find samples
Walter Wang [MSFT] - 06 Feb 2008 01:53 GMT
Hi,

You should only need to modify your web application's web.config to use an
IHttpHandler.

On the other hand, using some WebForm to output image data is also easy to
achieve, all you need is to correctly set the HTTP header and the
ContentType, please refer to following KBs:

How To  Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
(http://support.microsoft.com/kb/306654)

HOW TO: Read and Write BLOB Data by Using ADO.NET Through ASP.NET
(http://support.microsoft.com/kb/326502)

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.