Monday, 19 January 2015

ASP.NET Tips #17 - General and HTML tips

  1. Including height and width in <img /> tags will allow your page to render more quickly, because space can be allocated for the image before it is downloaded.
  2. Add script references at the bottom of the page before </body>, because asynchronous downloads halt when a script reference is reached. Style sheets and images can be downloaded asynchronously in <head>.
  3. Use a content delivery network (CDN) for hosting images and scripts. They may be cached and it will reduce load on your server.
  4. Use image sprites to retrieve smaller images in one download.
  5. Use AJAX to retrieve components asynchronously that may not be needed immediately, such as the content of a collapsed panel, content behind a tab, and so on.
  6. Make sure you've removed HTTP modules that aren't being used (Windows authentication, for example), and that you've disabled services such as FTP and SMTP, if you're not using them.
  7. Make sure HTTP compression is turned on for any uncompressed content. HTML in particular compresses significantly, and in this era of mobile friendliness and slow 3G connections, that’s essential.
  8. Always set the CacheControlMaxAge attribute in web.config to a high number (a year is good). You don't want people pulling down the same static content they did last week. It'll also save on the bandwidth you’re paying for.
  9. Make use of the OutputCache annotation on MVC controllers. If the server can serve from memory, rather than going to disk or database, that's a good win.

No comments :

Post a comment