Loading ASP.Net web page(s) faster

The following will help in loading a web page faster.

  • Always add javascript code at the end of a web page.

Add javascript code between end tags of the body and html tags. Browser loads DOM objects first and javascript code later. This will avoid blank browser loading page and user can see HTML objects in the browser very quickly.

  • Always set cache-expire in the response header.
  • Avoid viewstate for simple pages(by default view state enabled) or in pages where viewstate not needed.
  • Use gzip(or deflate) compression.

Compression can decrease the number of bytes by your server. This will help in loading pages faster and cuts down on bandwidth usage. But beware it might affect CPU performance as extra processing required to compress/uncompress. Major browsers currently supporting gzip and deflate compressions. GZIP compression is built into IIS6.0.

  • Avoid using HTML table(s). It was proven that browser takes more time to load a table.
  • Use gif files instead of JPG files
  • Avoid dataset walking for DB related logic instead use stored procedures.

For example, filters, sorting, searching etc.

  • Avoid Bind and Eval methods instead use code behind logic to load data.
  • Avoid too many postbacks, Use update panels(Asynchronous postback) or Ajax calls to refresh/update data.
  • Always follow guidelines to avoid javascript memory leaks.