Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:22:41+00:00 2026-06-14T20:22:41+00:00

On a .aspx page I am creating a bmp using the System.Drawing namespace. When

  • 0

On a .aspx page I am creating a bmp using the System.Drawing namespace. When the bmp is finished I am sending it to the browser using:

using (MemoryStream ms = new MemoryStream())
            {
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                byte[] buffer = ms.GetBuffer();
                HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length);
                HttpContext.Current.Response.Flush();
            }

This seems to simply send the bmp to the browser which renders it – but not as an html page. You can’t view source – it seems to be simply a bitmap.

I’d like the bmp to be sent to the browser but as the ‘content’ of the body tag of an html page.

Is the only way to do this to save (write) the bmp to disk and then use that file as the src of an image tag? Or is there a way of rendering it directly to the browswer but still as part of a html page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:22:42+00:00Added an answer on June 14, 2026 at 8:22 pm

    The simplist solution is to use two pages like this:

    a.aspx:

    <img src="b.aspx" />
    

    b.aspx:

    using (MemoryStream ms = new MemoryStream())
    {
        bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
        byte[] buffer = ms.GetBuffer();
        HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length);
        HttpContext.Current.Response.Flush();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented Forms authentication by creating Default.aspx and custom login page named login.aspx .
I have an ASPX page that is dynamically creating a gridview from a database
I have been creating an order status ASPX page that shows the Date, Carrier,
I have an ASPX page where in the page load i am dynamically creating
On aspx page I have a PlaceHolder that is inside Updatepanel. I am creating
I am creating an object at server side of an aspx (test.cs) page from
I am creating a server control that will sit in a aspx page. When
Aspx Page: $(document).ready(function() { $(#btnn).click(function() { $.ajax({ type: POST, url: TestPage.aspx/emp, data: {}, contentType:
On a aspx page, I have to load a DropDown with some values coming
In my .aspx page, I have download button which onclick download the .apk file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.