The server pieces that support AJAX development consist of ASP.NET Web server controls and components that manage the UI and flow of an application. The server pieces also manage serialization, validation, control extensibility, and so on. There are also ASP.NET Web services that enable you to access ASP.NET application services for forms authentication, roles, and user profiles.
Script Support
AJAX features in ASP.NET are implemented by using supporting scripts that are sent from the server to the client. Depending on what AJAX features that you enable, different scripts are sent to the browser.
You can also create custom client script for your ASP.NET applications. In that case, you can also use AJAX features to manage your custom script as static .js files (on disk) or as .js files embedded as resources in an assembly.
ASP.NET AJAX features include a model for release and debug modes. Release mode provides error checking and exception handling that is optimized for performance, with minimized script size. Debug mode provides more robust debugging features, such as type and argument checking. ASP.NET runs the debug versions when the application is in debug mode. This enables you to throw exceptions in debug scripts while minimizing the size of release code.
Script support for AJAX in ASP.NET is used to provide two important features:
Localization
The ASP.NET AJAX architecture builds on the foundation of the ASP.NET 2.0 localization model. It provides additional support for localized .js files that are embedded in an assembly or that are provided on disk. ASP.NET can serve localized client scripts and resources automatically for specific languages and regions.
For more information, see the following topics:
Web Services
With AJAX functionality in an ASP.NET Web page, you can use client script to call both ASP.NET Web services (.asmx) and Windows Communication Foundation (WCF) services (.svc). The required script references are automatically added to the page, and they in turn automatically generate the Web service proxy classes that you use from client script to call the Web service.
You can also access ASP.NET Web services without using ASP.NET AJAX server controls (for example, if you are using a different Web development environment). To do so, in the page you can manually include references to the Microsoft AJAX Library, to script files, and to the Web service itself. At run time, ASP.NET generates the proxy classes that you can use to call the services. For more information, see Web Services in ASP.NET AJAX.
Application Services
Application services in ASP.NET are built-in Web services that are based on ASP.NET forms authentication, roles, and user profiles. These services can be called by client script in an AJAX-enabled Web page, by a Windows client application, or by a WCF-compatible client. For information and examples, see. Using ASP.NET Web Services.
Server Controls
ASP.NET AJAX server controls consist of server and client code that integrate to produce rich client behavior. When you add an AJAX control to an ASP.NET Web page, the page automatically sends supporting client script to the browser for AJAX functionality. You can provide additional client code to customize the functionality of a control, but this is not required.
The following list describes the most frequently used ASP.NET AJAX server controls.
- ScriptManager
Manages script resources for client components, partial-page rendering, localization, globalization, and custom user scripts. The ScriptManager control is required in order to use the UpdatePanel, UpdateProgress, and Timer controls.
- UpdatePanel
Enables you to refresh selected parts of the page, instead of refreshing the whole page by using a synchronous postback.
- UpdateProgress
Provides status information about partial-page updates in UpdatePanel controls.
- Timer
Performs postbacks at defined intervals. You can use the Timer control to post the whole page, or use it together with the UpdatePanel control to perform partial-page updates at a defined interval.
You can also create custom ASP.NET server controls that include AJAX client behaviors. Custom controls that enhance the capabilities of other ASP.NET Web controls are referred to as extender controls. For more information, see Adding AJAX Functionality to ASP.NET Controls and ASP.NET AJAX Extender Controls Overview.