perfomance of .ashx handlers for retrieving a lot of binary images

asp.net, blob, database, httphandler, performance

Solution

First of all the browsers did not ask the images all together, but few at a time.

Second, the handler is not use session, so its not lock the one the other and so a parallel process can be done for the image call.

The extra that I suggest to add it a cache for the browser, so when its load an image to not ask it again.

An example:

context.Response.Cache.SetExpires(DateTime.Now.AddMinutes(120));
context.Response.Cache.SetMaxAge(new TimeSpan(0, 120, 0));

but you can add more aggressive cache.

One similar question: call aspx page to return an image randomly slow

Problem

I used .ashx handler for getting images from database.I want to retrieve a lot of images (>1000) in this way: ``` <img src='GetImage.ashx?id= <%# Eval("id") %>'/> ``` (why I do this you can understand if read my previous question: bind database image to ItemTemplate in .ascx ).I am afraid that multipiles database querys (first query to get all id's,all others for getting image one by one) will take a lot of time,is it? What are possible solutions?

Original source

Related problems