ASP.Net - Multiple dynamic images. Performance issues due to too many Http Requests -


I use a HTTindler to show images dynamically in the ASP.NET web application. I have a demonstration issue (there are a lot of HTPIREUXST in the Firefox / Firebug / YSLO report)

I have 50-100 images per page in some instances. 3 treeviews (business units / categories / objects) have their image with each node;)

The image URL for each item is set dynamically in this way ...

Some Image.ImageUrl = "/image.axd?ImageId={0}";

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

Extra: The images are located on the server file system, in a resource file and in the database - the user is also my system Upload your images to associate with objects, and ImageHandler will define each image location dynamically)

The httphandler is configured in web.config and works as expected ... Kris RAW image bytes have been returned in response to each image request in HTTPHolderLiner = "image.axd" type = "Add Vision.OnSiteManager.imageHandler"

context.Response.BinaryWrite (bytes);

Display all images correctly, so image bytes are returned in the WriteResponse () method of image sharing, but the functionality of the app are problems where many images are displayed ...

Question:

In addition to reducing image count, what approach do you suggest;), to reduce all HttpRequests generated for each image? Maybe combining in a single HTTP request?

I have read many CSS requests about using image mapping (a single image with offset) etc. in single request, but does not suit any particular scenario?

Very bound! One way to reduce the priority on the server at the duplication request is to use page cacheability.

Add it before the reaction. Type in the httpinder:

  // Set how long you want to cache the image context.Response.Cache.SetExpires (DateTime.Now.AddDays (1)); Context.Response.Cache.SetCacheability (HttpCacheability.Public); Context.Response.Cache.SetValidUntilExpires (true); Context.Response.Cache.VaryByParam ["ImageId"] = True;  

This enables the server to cache the results (depends on ImageId param), but it will definitely only help repeat requests for the same image, not the first , So it depends on where the problem really is.

Without knowing a lot about your application, it seems that you have to change many things to find a better solution ...


Comments