How to optimize an ASP.NET MVC website with these 20 points. PART-1

Tahir Alvi
2 min readOct 25, 2020

After reading this, one would have engough knowledge to developed an ASP.NET MVC site which will definately serve the purpose of its creation.

A survey mentioned that in 2020 if you search on google and from the search results, you click any of the suggestions sites. A normal user does not wait more than 4 sec to load and switch to the next search results. Until unless you are going to log in on a Social site. Naturally, no one wants to wait to load a site especially when the user on a mobile device.

Image Credits (Source: Unsplash)

In this article, I will try to explain all the main factors (actually not every) which must be taken care of by the web developer who writes codes for the ASP.NET MVC website and for the architect who designs the whole system for end-users. Actually, there are dozen ways to optimize an ASP.NET MVC site but I will only try to focus on the most common and important ones.

Let's first list it down and then I will provide the detail for each.

  1. Follow the Microsoft guide for design the modern website with ASP.NET MVC.
  2. Application Architecture should be clean
  3. Application Caching should be enabled (Views or especially for partial views).
  4. Always optimize the images.
  5. Use the Bundling and Minification religiously for JS and CSS files.
  6. Deploy in Release mode only, Debug mode hides the performance issues.
  7. Load only required data for a page
  8. Always use Client-side validations
  9. Take control of Server-side calls (database).
  10. Prefer ADO.NET over Entity Framework
  11. Use CDN if possible
  12. Use Zip/Compression via IIS
  13. Always try to use AJAX for getting data.
  14. Hierarchal Loading, CSS First, and JS at the END.
  15. Shrink Image and use of Sprite images
  16. Control the count of HTTP requests
  17. Use Visual Studio Profile or to discover memory leaks and performance issues.
  18. Use 3rd party online tools to check the performance before rolling out.
  19. Keeps the cookies size small, as cookies are sent to the server for every request.
  20. If using Razor, then always use the clear command in global.asax.cs

All the above points are not final points and make you guarantee, there are a lot of others. But as I have in the .NET world for a decade so in personal experience recommend that if one should care for above 20 points the site would be in much better response time than usual.

In part 2, I will explain all the above 20 points in detail.

Stay Haelthy and Enjoy Coding!