拾荒时代------技术,艺术!

.NET/Ajax/C#/Web2.0精品技术文章网摘。

导航

ASP.NET AJAX Overview



Introduction

Microsoft ASP.NET AJAX enables you to quickly create Web pages that include a rich user experience with responsive and familiar user interface (UI) elements. ASP.NET AJAX provides client-script libraries that incorporate cross-browser ECMAScript (JavaScript) and dynamic HTML (DHTML) technologies, and it integrates them with the ASP.NET 2.0 server-based development platform. By using ASP.NET AJAX, you can improve the user experience and the efficiency of your Web applications.

Why Use ASP.NET AJAX?

ASP.NET AJAX enables you to build rich Web applications that have many advantages over Web applications that are completely server-based. ASP.NET AJAX applications offer:

  • Improved efficiency by performing significant parts of a Web page's processing in the browser.

  • Familiar UI elements such as progress indicators, tooltips, and pop-up windows.

  • Partial-page updates that refresh only the parts of the Web page that have changed.

  • Client integration with ASP.NET application services for forms authentication and user profiles.

  • Integration of data from different sources through calls to Web services.

  • A framework that simplifies customization of server controls to include client capabilities.

  • Support for the most popular and generally used browsers, which includes Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari.

ASP.NET AJAX Architecture

ASP.NET AJAX consists of client-script libraries and of server components that are integrated to provide a robust development framework. In addition to ASP.NET AJAX, you can use the ASP.NET AJAX Control Toolkit and the features in the ASP.NET AJAX Futures releases, which are both community supported.

The following illustration shows the functionality that is included in the client-script libraries and server components.

ASP.NET AJAX Server and Client Architecture
ASP.NET AJAX server and client architecture

The illustration shows the functionality of the client-based Microsoft AJAX Library, which includes support for creating client components, browser compatibility, and networking and core services. The illustration also shows functionality of server-based ASP.NET 2.0 AJAX Extensions, which includes script support, Web services, application services, and server controls.

ASP.NET AJAX Server Architecture

The ASP.NET AJAX server components consist of ASP.NET Web server controls and components to manage the UI and flow of an application, and to 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 and user profiles.

ASP.NET AJAX Server Controls

The ASP.NET AJAX server controls consist of server and client code that integrate to produce AJAX-like behavior. 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.

ASP.NET AJAX Web Services

ASP.NET AJAX provides Web services that you can use from client script to work with ASP.NET application services for forms authentication and user profiles. This enables you to use client script to help protect resources by using forms authentication and to persist user-specific settings on the server. In addition, ASP.NET AJAX includes network components that make it easy to return results from any Web service call. For information and examples, see Asynchronous Communication Layer Overview and ASP.NET Application Services.

ASP.NET AJAX Server Control Extensibility

ASP.NET AJAX enables you to create custom ASP.NET AJAX server controls that include client behaviors. For more information, see the tutorials in ASP.NET AJAX Extensibility and the Microsoft ASP.NET AJAX Control Toolkit.

ASP.NET AJAX Client Architecture

The ASP.NET AJAX client-script libraries consist of JavaScript (.js) files that provide features for object-oriented development. The object-oriented features included in the ASP.NET AJAX client-script libraries enable a high level of consistency and modularity in client scripting. The following layers are included in the ASP.NET AJAX script libraries:

  • A browser compatibility layer. This provides compatibility across the most frequently used browsers (including Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari) for your ASP.NET AJAX scripts.

  • ASP.NET AJAX core services, which include extensions to JavaScript, such as classes, namespaces, event handling, inheritance, data types, and object serialization.

  • An ASP.NET AJAX base class library, which includes components such as string builders and extended error handling.

  • A networking layer that handles communication with Web-based services and applications, and that manages asynchronous remote method calls.

  • Support for JavaScript libraries that are either embedded in an assembly or are provided as standalone JavaScript (.js) files. Embedding JavaScript libraries in an assembly can make it easier to deploy applications and can solve versioning issues.

  • Support for accessing server-based forms authentication and profile information in client script. This support is also available to Web applications that are not created by using ASP.NET, as long as the application has access to the Microsoft AJAX Library.

  • Support for release and debug modes and localization support for both assembly-embedded and standalone JavaScript files. For more information, see the ASP.NET AJAX Debugging and Tracing Overview and Localizing Resources for Component Libraries Overview.

Debugging

The ASP.NET AJAX architecture provides a model for release and debug modes. Release mode provides error checking and exception handling optimized for performance, with minimized script size. Debug mode provides more robust debugging features, such as type and argument checking. If you create debug versions of custom client scripts or script resources, 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. 

A debug helper class, Sys.Debug, provides methods for displaying objects in readable form at the end of a Web page. It also shows trace messages, enables you to use assertions, and lets you break into the debugger. An extended Error Object object API provides helpful exception details with support for release and debug modes.

Localization and Globalization

The ASP.NET AJAX server and client architecture provides a model for localizing and globalizing client script. This enables you to design applications that use a single code base to provide UI for many locales (languages and cultures). For example, ASP.NET AJAX enables JavaScript code to format Date or Number objects automatically according to culture settings of the user's browser, without requiring a postback to the server

ASP.NET AJAX builds on the foundation of the ASP.NET 2.0 localization model. It provides additional support for localized script files that are embedded in an assembly or that are provided as .js files on disk. ASP.NET AJAX can serve localized client scripts and resources automatically for specific languages and regions.

For more information, see the following topics:

ASP.NET AJAX Control Toolkit

The ASP.NET AJAX Control Toolkit is a collection of samples and components that show you some of the experiences you can create with rich client ASP.NET AJAX controls and extenders. The Control Toolkit provides samples and a powerful SDK to make it simple to create and reuse custom controls and extenders. You can download the ASP.NET AJAX Control Toolkit from the ASP.NET Ajax Web site. The ASP.NET AJAX Control Toolkit is community supported.

ASP.NET AJAX Community-supported Futures Releases

The ASP.NET AJAX community-supported Futures releases provide features that extend the core ASP.NET AJAX platform with functionality that remains under development and that is not included in the Microsoft ASP.NET AJAX release. This includes additional extender controls, support for client declarative syntax (xml-script), and more. To download and learn more about the Futures release, see the ASP.NET AJAX Web site.


posted on 2007-05-21 18:34  拾荒时代  阅读(446)  评论(0编辑  收藏  举报