Balancing Client and Server Programming with ASP.NET AJAX


Without the advanced use of JavaScript running in the browser, web applications have their logic running on the server. This means a lot of page refreshes for potentially small updates to the user’s view. With AJAX, much of the logic surrounding user interactions can be moved to the client. This presents its own set of challenges. Some examples of AJAX use include streaming large datasets to the browser that are managed entirely in JavaScript. While JavaScript is a powerful language, the debugging facilities and options for error handling are very limited. Putting complex application logic on the client can take a lot of time, effort, and patience. ASP.NET AJAX allows you to naturally migrate some parts of the application processing to the client while leveraging partial page rendering to let the server control some aspects of the page view.

Some websites make an application run entirely from a single page request, where JavaScript and AJAX will do a great deal of work. This presents some tough challenges. Users generally expect that the Back button will take them to the state of the application they were just viewing, but with AJAX applications this is not necessarily the case. The client may be sending some information to the server for persistent state management (perhaps in server memory or a database), but this requires extra code and special attention to error handling and recovery.

The richest, most maintainable applications seem to be those that balance client and server resources to provide quick response times, easy access to server resources, and a minimum of blocking operations while new page views are fetched.

ASP.NET AJAX provides a mix of client and server programming features. The Microsoft AJAX Library is aimed at client development. It provides a type system for an object-oriented approach to JavaScript development. It makes it easy to register code to respond to events. It provides useful functions to simplify common tasks like finding elements on the page, attaching event handlers, and accessing the server. The server features include functionality for managing JavaScript code to be sent to the client, declaring regions of the page to be updated asynchronously, creating timers for continuous updates, and accessing ASP.NET services such as user profile data and authentication.




Professional ASP. NET 2.0 AJAX
Professional ASP.NET 2.0 AJAX (Programmer to Programmer)
ISBN: 0470109629
EAN: 2147483647
Year: 2004
Pages: 107

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net