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 8663895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:06:18+00:00 2026-06-12T17:06:18+00:00

We have an ashx image handler which has performed fairly well over the last

  • 0

We have an ashx image handler which has performed fairly well over the last few years, but we’ve recently noticed some odd intermittent behaviour in IE8 and IE9. We have a gallery page which calls the image handler multiple times as part of an image’s src attribute, this page is opened in a pop up window.

The page works fine when but when the window is opened and closed in quick succession (before all the images on the page have finished loading) it causes the browser to hang and subsequently has to be restarted.

Following is a sample of our image handler code, I have a suspicion that the request to the image isn’t ‘ending’ when the window is closed and the connection between the browser and the server is still running and causing it to crash.

Looking at the logs there are multiple attempts to GET the same image via the handler so it looks like the browser is retrying as it thinks it has failed to complete the request.

Are there any changes I could make to the handler (or the client code) to ensure the browser doesn’t continue requesting the images after the window is closed or is this a baked-in intricacy of IE? Safari, Firefox and Chrome handle this type of behaviour fine.

Alos note: The page displaying the images has an update panel around the grid – but I don’t think this is related.

Response.Clear();
Response.ContentType = "image/jpeg";
System.Drawing.Image returnImage = System.Drawing.Image.FromFile(completeImageFilePath);
using (MemoryStream stream = new MemoryStream())
{
    returnImage.Save(stream, ImageFormat.Jpeg);
    stream.WriteTo(Response.OutputStream);
}
returnImage.Dispose();
if (Response.IsClientConnected)
{
    Response.Flush();
}
Response.End();
  • 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-12T17:06:20+00:00Added an answer on June 12, 2026 at 5:06 pm

    Have you tried wrapping a using around returnImage to “ensure” that .dispose() is called?

    Response.Clear();
    Response.ContentType = "image/jpeg";
    using (System.Drawing.Image returnImage = System.Drawing.Image.FromFile(completeImageFilePath))
    {
        using (MemoryStream stream = new MemoryStream())
        {
            returnImage.Save(stream, ImageFormat.Jpeg);
            stream.WriteTo(Response.OutputStream);
        }
    }
    if (Response.IsClientConnected)
    {
        Response.Flush();
    }
    Response.End();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a generic handler Image.ashx that crops/resizes images on the fly by reading
I have created an ashx handler to render image thumbnails from images in a
I have an ASHX handler returning an image on page load. I need to
I have an image upload handler (.ASHX). I am storing image meta data in
I have created an ashx handler that returns an image to my flex app.
I have a function: window.onbeforeunload = function () { $.get(Handler.ashx, mode=saveuser&user= + $(#username).text(), function
I have an ASHX handler that I am using to display images that are
Is it possible to get a web resource from an .ashx handler? We have
I have a HTTP Handler which does not fire. i just noticed that adding
So I have an ashx file that creates an image with text written on

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.