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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:18:19+00:00 2026-05-11T05:18:19+00:00

I use an HttpHandler to dynamically serve images in a ASP.Net web application. I

  • 0

I use an HttpHandler to dynamically serve images in a ASP.Net web application. I am having a performance issue (Firfox/Firebug/YSlow reports there are too many HttpRequests)

I have between 50-100 images per page in some instances.. 3 treeviews (business units/categories/objects) with each node having its own image 😉

Each item’s image url is set dynamically like so…

SomeImage.ImageUrl = ‘/image.axd?ImageId={0}’;

Note: I only know at runtime which images will be required.

Additional: Images are located on the server file system, in a resource file and also in the database – users can upload their own images to associate with my system objects and the ImageHandler will determine each image location dynamically)

In the web.config the httphandler is configured and works as expected… add verb=’GET’ path=’image.axd’ type=’Vision.OnsightManager.ImageHandler’

In the HttpHandler the raw image bytes are returned in response to each image request. So in the WriteResponse() method of the image handler the image bytes are returned, like so…

context.Response.BinaryWrite(bytes);

All images display correctly, but the app has performance problems as expected where many images are displayed…

Question:

What approach do you recommend, apart from reducing image count ;), for minimizing all the HttpRequests generated for each image? Maybe combining into a single Http request?

I have read articles on combining multiple css requests into a single request, using image mapping (single combined image with offsets) etc, but none seem to suit my particular scenario?

Much obliged!

  • 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. 2026-05-11T05:18:20+00:00Added an answer on May 11, 2026 at 5:18 am

    One way to reduce the preasure on the server on repeated requests is to use the page cacheability.

    Add this before Response.Write in the HttpHandler:

    // Set for how long you want the image to be cached. context.Response.Cache.SetExpires(DateTime.Now.AddDays(1));  context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetValidUntilExpires(true); context.Response.Cache.VaryByParams['ImageId'] = true; 

    This will make the server to cache the result (depending on the ImageId param) but this will of course only help on repeated requests for the same image, not the first one, so it depends on where the actually problem is.

    Without knowing very much about your application it sounds like you have to change several things to find a better solution…

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

Sidebar

Related Questions

As i know that asp.net fulfill all the requirements for any web application but
I have created a HttpHandler that I would like to use with my asp.net
I need a simple HttpHandler to handle specific non-existant paths in my ASP.NET project.
I've been using user controls extensively but never use a HttpHandler and was wondering
Use case: 3rd party application wants to programatically monitor a text file being generated
I use Firebug and the Mozilla JS console heavily, but every now and then
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B
We use a data acquisition card to take readings from a device that increases
I use rsync to synchronize files to Windows clients in a server agnostic way.

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.