Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Best Practices : Asp.Net Application Performance.

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 102
    Comment on it

    Performance tuning of Asp.Net application can be a complex task because multiple components are involved. In the list below we will go through best practices to improve ASP.Net Web application performance.


    1) We should disable ViewState if it is not required because it leads to the bloating of the web pages in size.
       ViewState can be disabled at both control level and at page level using the below piece of code :
       <%@ Page EnableViewState="false" %>  


    2) With appropriate use of caching we can cache entire pages or parts of pages and such cached data can be served directly on repetitive request.


    3) We should use HTTP compression which ensures that content is transferred in compressed form from servers to browsers.


    4) Tracing should be disabled in production environment. For disabling tracing we need to make changes in web.config as below:
       <trace enabled="false" requestLimit=”10” pageoutput=”false” traceMode=”SortByTime” localOnly=”true”>


    5) During deployment we should use only Release mode and not Build mode before deploying sites to production environment.


    6) In case we are fetching large result sets we should use paging to reduce volume of data being sent to the client.


    7) We should use client side validation to avoid unnecessary trips to the server. However even after doing client side validation we should always do server side validation also.


    8) We should minimize the use of server control because they are executed on server side and thus increase response time.


    9) Session State should be disabled if not being used.
       For disabling session state on your web form use the below directive,
       <@%Page EnableSessionState="false"%>


    10) We should avoid Response.Redirect  , in case we are transferring within same server we should use Server.Transfer .


    11) By default, ASP.NET uses  UTF-8 to encode requests and responses.However if  ASCII is sufficient for the application needs, we should not use UTF-8 rather ASCII.


    12) Use StringBuilder for modifying strings because using simple concatenations will lead to additional references for each operation done on string.


    13) We should avoid throwing exceptions because throwing an exception is a costly operation and if not used carefully can lead to performance issues.


    14) The styleSheets should be placed in the Header.


    15) The scripts should be placed the end of Document.


    16) It is a best practice to use external JavaScript and CSS files  because these files are cached by the server leading to improved performance.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: