O'Reilly logo

Programming ASP.NET 3.5, 4th Edition by Jesse Liberty, Dan Hurwitz, Dan Maharry

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. ASP.NET must execute more code and makes more network requests to process, alter, and maintain session state for every page request and postback that a user makes. So, if your website contains any pages that do not need to use session state, 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 ...

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