In this article I will sharing few tips to improve the performance in ASP.NET site. This is the things that I have done:
1. HTTP Compression
HTTP compression is used to compress page content from the server end. It compress HTTP requests and responses, so is a great performance improvement. My project is hosted in Windows Server 2003, and I implemented HTTP compression after reading this article.
2. Disable Possible ViewState
View State allows the page state to be persisted with the client, and it does not require cookies or server memory. View State saves data in a hidden input filed inside a page. Definitely, it is a powerful feature, but the drawback is it increases page size and memory allocation in the server.
So, we should avoid View State where it is not necessary. Especially, in the case of DataGrid controls, we should avoid View State as it loads all the grid data in the page state.
In my application, I disabled View State for most of the controls and pages where View State is not necessary. This made the page sizes smaller.
3. Changes in the Web.Config File
a. Use page caching:
This will save your page only for a certain amount of time, and the page will be faster to load. But, remember that if your page data changes frequently, it is not a good idea to use page caching.
<add name="cached" duration="600"
b.Remove unnecessary httpModules from the web.config:
<remove name="WindowsAuthentication" />
<remove name="PassportAuthentication" />
<remove name="AnonymousIdentification" />
<remove name="UrlAuthorization" />
<remove name="FileAuthorization" />
c.Turn off trace:
<trace enabled="false" pageOutput="false" />
d.As I have used membership, I disabled automatic save for profiles:
<profile enabled="true" automaticSaveEnabled="false" />
4. Optimize Stylesheets
It is important to clean up style sheets and remove unnecessary code from style sheets because it increases the load time. Remove all unnecessary classes from style sheets and try to use a single CSS file.
6. JS and CSS File Position
According to the advice from some good articles, I put the CSS file declaration at the top of my master page. It is recommended to call CSS files at the top of a page because the page rendering will progressively become efficient.
7. Client-side Script for Validation
For page validation, I use client-side validations instead of postbacks. This way, I reduce round trips in pages.
The above are few trips to improve your ASP.NET performance.
Looking for ASP.NET hosting on European server? Please visit HostForLIFE.eu. HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.microsoft.com/web/hosting/HostingProvider/Details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.