How can we improve the Performance of an ASP.NET Web Page?

This is the most common question from the ASP.NET forum in any interview. In this post I’m going to point out some of the important points that may help to improve the performance.

Here I used the word “improve performance” in the sense to decrease the loading time of the page. There are various reasons behind this. Some of them we look into from the “backend side” (Database side) and rest of them we need to take care in “front-end” ((UI) side.

For illustrative purposes, you have an ASP.NET Web site, one of the aspx page take much time to load. Throughout this article, we are going to see how to decrease the loading time.

Back End (DB)

  • Try to check the Query performance – that is how much time the query will take to execute and pull the records from DB. Then use SQL Server Profiler and Execution plan for that query so that you can come to a conclusion in which part it took much time.
  • Check in every table (who are all part of the query) Index is created properly.
  • If your query involves a complex stored procedure, which in turn use lot of joins, then you should focus on every table. In some cases, sub-query perform better than the joins.
  • If your web page involves paging concepts, try to move the paging concepts to SQL Server. I meant that based on the page count the SP will return the records, instead of bringing the records as a whole.