Top 7 Tips to Improve Your ASP.NET Application Performance

Author: Rakesh Chitroda

ASP.NET is a web application server framework that has been designed to make the process of website development easier, especially for the creation of dynamic web pages. It is important to understand the usefulness of ASP.NET applications in building efficient, robust and reliable.

Below are my top 7 tips to improving ASP.net application Performance:

1. Use HTTPServerUtility.Transfer instead of Response.Redirect

Redirects are also very chatty. They should only be used when you are transferring people to another physical web server. For any transfers within your server, use. Transfer! You will save a lot of needless HTTP requests.

2. Always check Page.IsValid when using Validator Controls

So you've dropped on some validator controls, and you think your good to go Because ASP.net does everything for you! Right? Wrong! All that happens if bad the data is received is the IsValid flag is set to false. So the make sure you check Page.IsValid before processing your forms!

3. Deploy with Release Build

Make sure you use the Release Build mode and not Debug Build when you deploy your site to production. If you think this does not matter, think again. By running in debug mode, you are creating PDB’s and cranking up the timeout. Deploy Release mode and you will see the speed improvements.

4. Pre - Compiling ASP.NET Application

When compiling an ASP.NET application project, a single assembly is created to hold all the application’s code but the web pages (. Aspx ) and user controls (. Ascx ) not compiled and be deployed as it is. In the first request ASP.NET dynamically compiles the web pages and user control and places the compiled files in the ASP.NET temporary files folder.

To reduce the time of the first request a web application can be pre-compiled, Including all the code, pages, and user controls, by using the ASP.NET compilation tool ( Aspnet_compiler.exe ). Running this tool in production servers can reduce the delay users experience on first requests.

a. Open a command prompt in your production server.

b. Navigate to the % windir % Microsoft.Net folder

c. Navigate to either the Framework or Framework64 According to the configuration of the web application’s application pool.

d. Navigate to the framework version’s folder.

e. Enter the following command to start the compilation

Aspnet_compiler.exe - v / FullPathOfYourWebApplication

5. Disable Session State

Disable Session State if you're not going to use it. By default it’s on. You can actually turn this off for specific pages, instead of for every page:

You can also disable it across the application in the web.config by setting the value to off mode.

6. Repeater Control Good, DataList, DataGrid, and DataView controls Bad

ASP.Net development Services

Asp.net is a great platform, unfortunately a lot of the controls that were developed are heavy in html, and create not the greatest scaleable html from a performance standpoint. ASP.net repeater control is awesome! Use it! You might write more code, but you will thank me in the long run!

7. Create Per -Request Cache

Use HTTPContect.Items to add single page load to create a per - request caching.