Working with Ajax Server Extensions | WebReference

Working with Ajax Server Extensions

By Joydip Kanjilal

Ajax, an acronym for Asynchronous JavaScript and XML is a combination of different technologies, used for building rich and responsive user interfaces. According to Enrich Peterson, "AJAX-enabled pages provide a slick, responsive user experience, making web-based applications function more like desktop-based ones". Ajax has quickly become the technology of choice for building lightning fast and responsive user interfaces. The ASP.NET Ajax Server Framework is composed of a collection of server controls and services that extend the functionality of the ASP.NET core. These commonly are known as ASP.NET Ajax Server Extensions. This article looks at the ASP.NET Ajax Server Extensions Framework and how you can work with it.

What are ASP.NET Ajax Server Extensions?

David Barkol, one of the authors of the famous book ASP.NET Ajax in Action states in his blog: "In ASP.NET AJAX, the Ajax Server Extensions consists of a powerful set of server controls that simulate Ajax behavior on the client. In other words, these controls do not perform Ajax in its traditional sense (JavaScript calls to a server and dynamic updates with DHTML) but rather in a different way that gives the same illusion to the end user."

The following are the namespaces included as part of the ASP.NET Ajax Server Extensions Framework:

  • System.Web.UI – this namespace includes classes that provide support for implementing rich user interfaces
  • System.Web.UI.Design – this is comprised of classes that you can extend to attach functionality to the existing classes to implement rich and intuitive user interfaces
  • System.Web.Configuration – this includes classes that can be used to work with configuration data using ASP.NET Ajax
  • System.Web.Handlers - this namespace is comprised of a collection of Http Handlers used to process the HTTP requests sent to the web server
  • System.Web.Script.Serialization - this namespace includes a collection of classes for providing support for object serialization and de-serialization in your application
  • System.Web.Script.Services – this namespace is comprised of a collection of classes that can be used to customize the behavior of web services that you would like to invoke from client side scripts

Services Provided By the ASP.NET Ajax Server Extensions Framework

ASP.NET Ajax Server Extensions provide the following services:

  • Localization and Globalization
  • Authentication
  • Debugging
  • Tracing
  • Web services
  • Application services

We will now take a look at what each of these services are and how they can be used. Globalization and Localization are two important concepts. While the former relates to identifying the specific portion of the application's code to be localized, the latter is used to change a portion or portions of your application's core to make it adaptable for a specific locale.

Authentication and Authorization are two important concepts in ASP.NET Security. You can validate a user by authentication. Note that you can authorize an authenticated user only. So, authorization works only after the user has been authenticated.

Debugging and tracing are two important concepts used for identifying the problems in your application's code. The MSDN site states, "AJAX-enabled ASP.NET applications contain a mix of server code and client code. The browser can also request additional data asynchronously. This can make debugging AJAX-enabled Web applications challenging." The Sys.Debug class provides support for debugging and tracing functionality of your client side scripts in ASP.NET Ajax. Here is how you can turn debugging on for your application in the application's web.config file:

Note that tracing can be enabled both at the page and at the application levels. Here's how you can enable tracing at the page level:

To enable tracing support at the application level, you can use the following code in your application's web.config file:

Web Services are Open Standard Enterprise Web Applications that are based on the SOAP protocol and are used for the efficient exchange of data on the same or disparate systems irrespective of the architecture. According to MSDN, "Web Services are based on a core set of standards that describe the syntax and semantics of software communication: XML provides the common syntax for representing data; the Simple Object Access Protocol (SOAP) provides the semantics for data exchange; and the Web Services Description Language (WSDL) provides a mechanism to describe the capabilities of a Web service." You can use Ajax to invoke Web Services from client side scripts seamlessly.

Components of the ASP.NET Ajax Server Extensions Framework

The ASP.NET Ajax server extensions framework comprises of the following components:

  • The Application services bridge - this is used to provide access to the application services that are available as part of the ASP.NET framework
  • The Web services bridge - this is used to consume external web services from the client side scripts
  • The ASP.NET Ajax Server Controls - these are server controls provided as part of the ASP.NET Ajax server extensions framework for Ajax support in ASP.NET

The major ASP.NET Ajax Server Controls include the following:

  • Timer – This control is used to refresh content of a web page at pre-defined intervals of time.
  • ScriptManager – This is the brain of an Ajax enabled web page. Note that in order to implement partial page rendering, you should set the EnablePartialRendering property of the ScriptManager control to true.
  • ScriptManagerProxy - A ScriptManagerProxy control is used in a content page to pass references to a ScriptManager control placed in a master page to define Ajax behavior. Note that you can have only one ScriptManagerProxy control in your web page.
  • UpdateProgress – This control is typically used to show the progress while an update operation in partial page rendering process is in progress. It facilitates designing an intuitive user interface while a partial page rendering is in progress. In essence, it can be used in conjunction with the Update Panel control to enhance the user experience while some asynchronous update operation is in progress in your Ajax enabled ASP.NET web pages.
  • UpdatePanel – You need to use this control to implement partial page updates in an Ajax enabled web page. Any control that you would want to participate in partial page updates or partial page rendering process should be contained inside an UpdatePanel control. Partial-page rendering can be used to refresh only a portion of your web page rather than the entire page. Note that there can be only one ScriptManager control but any number of UpdatePanel controls in your web page.


ASP.NET Ajax Server Extensions Framework is comprised of a collection of server controls that you can use to Ajax enable your ASP.NET web application with ease. In this article, we have had a look at the ASP.NET Ajax Server Extensions Framework and its components and how we can work with it. You can learn more on this framework from my upcoming book titled, "ASP.NET 4.0 Programming". Here is the link to the book at Amazon: