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

  • Home
  • SEARCH
  • 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 5983667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:15:50+00:00 2026-05-22T22:15:50+00:00

For some strange reason, a five year old internal asp.net web app that is

  • 0

For some strange reason, a five year old internal asp.net web app that is used through IE6 has suddenly developed an issue, even though there have been no code changes. Certain images that are being streamed back to the web browser aren’t appearing for some users.

I don’t know why this was suddenly started happening or what the cause is – however as part of the search, I’m considering if there’s a flaw in the code used to stream back images.

The image is held in memory are a byte array, then streamed back using the following code. Is this the best way to stream an image back?

Response.Clear();
Response.ClearHeaders();
Response.ClearContent();        

// Work out file type
switch( Path.GetExtension( imageFilename ).ToLower() )
{
    case ".jpg":
    case ".jpeg":
        Response.ContentType = "image/jpeg";
        break;
    case ".gif":
        Response.ContentType = "image/gif";
        break;
    default:
        Response.ContentType = "binary/octet-stream";
        break;  
}

Response.AddHeader("Content-Length", imageBytes.Length.ToString() );
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite( imageBytes );
Response.End();

Instead of an image being shown in the page, a red cross is displayed. This only happens with the dynamically generated images shown on the page, rather than the statically linked images.

If I try and open the image in it’s own window, I either see the image or a load of gobbledygook text (Which I’m guessing means the MIME type isn’t being set/picked up by the browser)

  • 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-05-22T22:15:50+00:00Added an answer on May 22, 2026 at 10:15 pm

    Response.End() is generally bad as it aborts the IIS thread even if it’s in the middle of Flush()-ing.

    Use Response.Flush() followed by Response.Close() to make sure all content is sent to the client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET MVC 3 Beta and for some strange reason, if I change
For some strange reason, an alert dialog with the text title Message From Web
Something really weird is happening to my Rails app. For some strange reason, jQuery
So, for some strange reason I end up with a 100GB log file that
For some strange, bizarre reason, my images in my website just will not display
I'm writing some mail-processing software in Python that is encountering strange bytes in header
For some strange reason, when I move a PHP file from one folder to
For some strange reason, the \n and \r escape sequences do not seem to
For some strange reason, UITableView resizes my cells to 320 width no matter how
For some strange reason, in iPhone OS 3.0 this doesn't work: I made a

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.