Hi,
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!