O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performance

Performance is often an important issue in computer applications, especially in web applications receiving a large number of requests. One obvious way to improve performance is to buy faster hardware with more memory. But you can also tune your code to enhance performance in many ways, some of them significant. We'll begin by examining some of the areas specific to ASP.NET that offer the greatest performance improvements and then examine some of the general .NET topics related to improving performance.

Tip

Several Microsofties involved with writing the .NET Framework used the word performant to mean that something is delivering higher performance. We can't find it in any dictionary, but it seems like a good word.

ASP.NET-Specific Issues

Correctly using the following features of ASP.NET offers the greatest performance improvements when an ASP.NET application is running.

Session state

Session state is a wonderful thing, but not all applications or pages require it. For any that do not, disable it. You can disable session state for a page by setting the EnableSessionState attribute in the Page directive to false, as in this example:

    <%@ Page Language="C#" EnableSessionState="false"%>

If a page will not be creating or modifying session variables but still needs to access them, set the session state to read-only:

    <%@ Page Language="C#" EnableSessionState="ReadOnly"%>

By default, web services do not have session state enabled. They only have access to session state if the EnableSession ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required