Improve ASP.Net Performance
1. Use IsPostBack page method to check the page load status, your code may contain code blocks that you want to execute only when the page loads the first time, you can avoid call to this procedures if you check the status of the Page load.
2. Use View state for only those controls, what you really need. You can disable the viewstate for a control, there are various option from the application level to the control level (This is explained in another article in this site). So disable the viewstate for controls, which you don’t need.
3. Use HttpServerUtility, Most of the time we use response objects redirect method to redirect the request to another page, which will require another round back to the server, Which cause a delay in loading the page. Instead you can make use of Transfer or Execute method of HttpServerutility.
4. Use Stored Procedure for data access, instead of using long and complex SQL queries which need time to compile and execute.
5. You should only use sessions where they are actually required. You can turn off the session management at the page level.
6. Exception are good for error handling, but remember it takes a lot of the processing to try and catch, so use exception only when you really require it.
7. Use Output Caching for the pages where you have data, which are not changed too frequently. Also remember too many caching pages too can degrade the performance of your application.
8. Use Server side controls only where appropriate.
9. For accessing MS SQL Server database , don’t use System.Data.OleDb namespace, instead use System.Data.SqlClient. This namespace provides classes, which are much faster and more efficient.
10. User DataBinding, Normally we use a rowset to dynamically load the data to a control, wherever possible make use of the data binding capabilities of the control.
11. Use Early bindings, it’s a general practice to declare variables of object type and later convert it to the type, which we require, to process. This takes too much memory and processing. So wherever possible make use of the correct type for the variables. To strictly follow this, make use of Option Strict and Option Explicit in the beginning of the code block.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|