asp.netPRO Download a Free Evaluation Today!



Subscription Services
Print Subscription
Online-Only Subscription
Renew Subscription
asp.netNOW Newsletter
Change of Address
Pay An Invoice
Subscription Packages

asp.netPRO
Articles
411asp.net Directory
New Products
Book Reviews
Blog Listings  
E-Newsletter Articles- NEW
Events  - NEW 
Job Listings  
Product Reviews
Opinion
Back Issues
Reprints/E-prints
Search

Downloads
Premium Downloads


Informant
Contact Us
Advertise with Us
Write For Us



 
 
 


Fully Loaded Windows Servers


Architecture & Design World 2008 2008 Fall Conference in Las Vegas
2007 asp.netPRO Complete Works CD
Co-Sponsored by:
Download your free trial now!


Click here for the online product directory, asp.netPRO Product Portal

 

Latest Features

 •

Conflict Resolution


 •

Cause and Effect


 •

Why Are You Still Single?


 •

Future Features of ASP.NET


 •

WCF Proxies: To Cache or Not to Cache?



Article Rating



Tell a friend
about this article!




asp:Feature

LANGUAGES: C#

ASP.NET VERSIONS: 2.0

 

It’s All in the Timing

Reduce the Initial Load Time of Your ASP.NET Web Pages

 

 

This article highlights the strategies that one can adopt for faster page renderings in ASP.NET. It discusses such factors as caching, viewstate, and ASP.NET page precompilation.

 

The Strategies

To start, reduce your working set size by removing all unnecessary .dll files. Reduce the size of your viewstate or disable it altogether to minimize the size of your viewstate and thus facilitate faster page rendering. You should disable viewstate for controls that do not require it. Further, you can remove the runat=“server” form tag completely to reduce page size by 20 bytes. If you don’t remove this tag, the page itself passes on about 20 bytes of information to viewstate, even when the page’s ViewState property is set to false.

 

Use ASP.NET 2.0’s new feature called precompilation effectively to reduce the page load time of your Web pages by compiling the application’s code at run time. You can pre-compile Web pages in your application to reduce the working set size and boost application performance.

 

ASP.NET 2.0 provides this excellent feature and makes it available in the following two distinct modes:

  • In-place precompilation
  • Precompilation for deployment

 

You can learn more about precompilation, its types, and benefits in my article “Boost ASP.NET Performance with Precompilation”.

 

You can set the autoEventWireup attribute to “false” in the Machine.config file to improve performance further. Refer to the code snippet given here:

 

<configuration>

 <system.web>

   <pages autoEventWireup="true|false" />

 </system.web>

</configuration>

 

The autoEventWireup attribute accepts a Boolean value that indicates whether the ASP.NET page’s events are auto-wired. If the autoEventWireup is set to false, the runtime does not have to look for each of the page event handlers. MSDN states, “When you explicitly set AutoEventWireup to true, Visual Studio .NET or Visual Studio 2005, by default, generates code to bind events to their event-handler methods. At the same time, the ASP.NET page framework automatically calls the event-handler methods based on their predefined names. This can lead to the same event-handler method being called two times when the page runs.”

 

Further, ensure that the tables, cells, and images you use in your Web pages have their width and height set properly so that the browser can prepare placeholders for items and render faster. Avoidance of excessively large images, nested tables, and redundant tags in the Web pages would also yield a faster page render.

 

You can use caching for better performance of successive page renderings. It is great for storing relatively static application data as it reads data from memory to avoid repeatedly retrieving data from a database, file, or any other repository. Judicious use of the right type of caching can go a long way toward improving the performance of your ASP.NET applications, and it can reduce the time required for successive page renderings where your Web page requires relatively static data.

 

You can check the load time of your ASP.NET Web pages by enabling the trace in the page. For this, enable the trace option in your .aspx file and set the TraceMode property = “SortByTime”. Refer to the code snippet below:

 

<%@ Page Language="C#" AutoEventWireup="true" trace="true" TraceMode="SortByTime" CodeFile="Test.aspx.cs" Inherits="Test" %>

 

Follow these additional strategies for improving the overall performance of your ASP.NET Web applications:

  • Avoidance of unnecessary roundtrips to the Web server through the use of client-side scripts
  • Efficient exception handling and data access strategies
  • Optimized code for efficient garbage collection

 

Read my article “Improving Application Performance in .Net” to learn more about the strategies that can be followed to improve the overall performance of your ASP.NET Web applications.

 

Conclusion

In essence, one should be aware of the most important strategies on how to optimize the applications so that they have the least amount of memory, processor, network, and IO overload. Here we took a quick look at some of the best measures for improving the response time of your ASP.NET Web pages.

 

Working extensively in Microsoft technologies for more than 10 years, Joydip Kanjilal is a Senior Technical Leader in the Design and Architecture team for a company in Hyderabad, India. His programming skills include C, C++, Java, C#, VB, VC++, ASP.NET, XML, and UML. An ASP.NET MVP, he has worked with .NET and C# for more than five years. Reach Joydip at mailto:joydipkanjilal@yahoo.com or at his blog at: http://aspadvice.com/blogs/joydip/.

 

 

 

 

Microsoft Internet Explorer
Top of page

 

Download a Free Evaluation Today!

Informant Communications Group

Informant Communications Group, Inc.
5105 Florin Perkins Road
Sacramento, CA 95826
Phone: (916) 379-0609 • Fax: (916) 379-0610

Copyright © 2008 Informant Communications Group. All Rights Reserved. • Site Use Agreement • Send feedback to the Webmaster • Important information about privacy