News Stay informed about the latest enterprise technology news and product updates.

Using ASP.NET AJAX for large-scale Web applications

ASP.NET page performance can be hampered by huge files stored in viewstate. By replacing postbacks with callbacks, ASP.NET AJAX can significantly reduce this bandwidth load.

Our ASP.NET AJAX series
In this three-part series, SearchVB.com takes a close look at ASP.NET AJAX development.

Part 1 takes a look at what makes programming with ASP.NET AJAX different from programming with ASP.NET.

Part 2 considers the capacity for ASP.NET AJAX applications to operate faster, and on a larger scale, than traditional ASP.NET apps.

Part 3 examines the security concerns raised by ASP.NET AJAX development and offers some thoughts on how to combat them.
One of the key benefits of Ajax is the ability to precisely deliver data where it is needed to parts of the interface in order to reduce the overall bandwidth and server load. In other words, a page refresh occurs only on the part of the page where data is changing, and the rest of the page remains static.

"Things like the script manager and the update control panel allow different parts of the page to perform partial rendering," said Brian Finnerty, director of marketing for InnerWorkings, a Windows programming consultancy. "With the update control panel, you can enable partial updates and can control where updates are rendered on the page."

As one example of this, Phanfare.com, a photo sharing application, is using ASP.NET AJAX to make it easier for users to make changes to their photo albums, which may consist of thousands of thumbnail images.

Michael Cichowski, software engineer at Phanfare, praised JavaScript's rich interactivity. "In our case, you want to refresh a portion of a page with 1,000 photos. You don't want to refresh all of them when you want to upload one little widget," he said. "This increases the interactivity and the richness and takes off some of the load from the server."

However, as an ASP.NET application, Phanfare had to be crafted carefully in order to get the maximum scalability.

As Jeff Prosise, co-founder of .NET consultancy Wintellect, put it, "Ajax is good at minimizing traffic over the wire. But ASP.NET pages can store the state in a hidden input field.

In one of the demos Wintellect performed, its developers were able to replace 50 to 100 kilobytes of viewstate data with a 10-byte callback.
,
If you are not careful, you can significantly slow down the bandwidth."

ASP.NET pages typically render out a large tag that is stored as a viewstate, he noted. ASP.NET transmits viewstate up to the server by default because the code on the server might need to make a change to one of the controls.

"In the traditional ASP.NET model, it is not the pages themselves that are stored in the viewstate -- it is the state of the pages," Prosise noted, adding that it is quite common to have 50 kilobytes stored in viewstate.

When you design a page in ASP.NET AJAX, though, code can be written so that no viewstate goes back up, Prosise said. In turn, JavaScript code on the client can be used to update that state, plus any controls that need updating.

Prosise recommend replacing postback functions with callback in Ajax, which, if done right, can reduce the data going over the wire by three orders of magnitude.

"The key is getting rid of the viewstate and not having to round trip it. You don't need to send it up and down the wire every time," he said. "It is easy to replace those heavy postbacks with lightweight callbacks. It makes the whole thing more scalable because you are not processing as much data on the server as you were before."

More on ASP.NET AJAX
ASP.NET AJAX Learning Guide

Tip Series: Get started with ASP.NET AJAX development: Part 1  |  Part 2  |  Part 3

Prosise continued: "In an ASP.NET AJAX application, a programmer can do away with the postback, and when the user clicks a button, the application just sends a lightweight Ajax callback to the server. This lets the application be more precise."

The amount of bandwidth a programmer can save depends on the nature of the callback. In one of the demos Wintellect performed for SearchVB.com, its developers were able to replace 50 to 100 kilobytes of viewstate data with a 10-byte callback.

Dig Deeper on ASP.NET and Ajax development

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

SearchCloudApplications

Close