Datasheet

Chapter 1: AJAX Technologies
24
Things are pretty simple on the client side, as you can see in the following code fragment from Listing 1-4 :
var response = request.responseText;
eval(“var employee=” + response + “;”);
This simply calls the eval JavaScript function to deserialize an employee object in the JSON string
received from the server. As you can see, the messy XML deserialization code presented in Listing 1-3 is
all gone and replaced with a simple call into the
eval JavaScript function. However, this simplicity
comes with a price. Because the
eval JavaScript function basically trusts the scripts that it runs, it intro-
duces serious security issues. This is not a problem in this example because the JSON representation is
coming from a trusted server. However, in general, you must be very careful about what gets passed
into
eval .
ASP.NET AJAX
The ASP.NET AJAX framework brings to the world of AJAX-enabled Web application development
what ASP.NET and the .NET Framework brought to the world of server-side Web application
development over the past few years. The biggest advantage of ASP.NET over the earlier server-side
Web development technologies such as the classic ASP is that you get to program in the .NET Frame-
work, which provides the following benefits among many others:
The .NET Framework is a full-fledged, object-oriented framework that enables you to take full
advantage of all the well-known benefits of object-oriented programming such as classes, inter-
faces, namespaces, polymorphism, inheritance, and the like.
The .NET Framework comes with a large set of managed classes with convenient methods,
properties, and events that save you from having to write lots of infrastructure and generic code
that have nothing to do with the specifics of your application.
The .NET Framework includes a full-fledged typing and type-reflection system that enables you
to perform runtime type inspections, discoveries, instantiations, invocations, and the like.
The .NET Framework provides you with groundbreaking facilities and capabilities such as the
following:
Application lifecycle and its events: The HttpApplication object that represents an ASP.NET
application goes through a set of steps or phases collectively known as the application life-
cycle. This object raises events before and/or after each lifecycle phase to allow you to cus-
tomize the application lifecycle.
Page lifecycle and its events: Every ASP.NET page goes through a set of steps or phases
collectively known as the page lifecycle. The
Page object that represents the ASP.NET page
raises events before and/or after each lifecycle phase to allow you to customize the page
lifecycle.
Server controls: Server controls enable you to program against the underlying markup
using the .NET Framework and its rich, object-oriented class library. This gives you the
same programming experience as these server controls desktop counterparts provide.
c01.indd 24c01.indd 24 8/20/07 5:40:12 PM8/20/07 5:40:12 PM