views:

734

answers:

3

I'm trying to find the best way to speed up the delivery of the static images that compose the design of an mvc site. The images are not gzipped, nor cached in the server or on the client (with content expire). Options are:

  1. Find why images are not cached and gzipped direcly from IIS6
  2. Write a specialized http handler
  3. Register a special route for static images and write a bynary actionresult method

What could be the best solution in terms of performance?

+3  A: 

Best solution is to let IIS do it.

IIS6 Compression - most likely you need to specify file types to be compressed like .jpg, .png, .gif types, etc.

Caching will come from making sure that the correct headers are being sent to the client from code, and i believe there is a setting you can set in IIS that enables it for static content, but i'm not sure on that one.

Darren Kopp
Jeff Atwood List some problems he’s run into while enabling compression http://www.codinghorror.com/blog/archives/000059.html
Cherian
+1  A: 

There's a nice library up on the MSDN Code Gallery that does this. It's called FastMVC.

Paul Mrozowski
+2  A: 

Surely the gain from gzipping most images is negligable since they're already compressed ?

Naybe you have some really badly compressed PNG files or something?

You might want to check out yahoo's performance advice site which includes some useful tips on optimizing images including links to utilities such as pngcrush.

its much better to use an image optimizing utility ONCE than to rely on IIS to compress them (possibly inefficiently) on the fly.

Simon_Weaver