Now thatyou have seen a simple ASP.NET AJAX-enabled Web application, you can examine itmore closelyto see how itworks. The firstthing to look atisthe Web. conf ig fileforthe application,in particularthe following two blocks of code in the <system.web> configuration sectionof <configuration>:
The code in the <assemblies> configuration section in <compilation> ensures that the ASP.NET AJAX System. Web. Extensions. dll assembly is loaded from the GAC. The code in the <controls> configuration element in <pages> references this assembly and associates the controls it contains (in both the System. Web. VI and System. Web. UI. WebControls namespaces) with the tag prefix as. These two sections are essential for allASP.NET AJAX-enabled Web applications.
The next two sections, <httpHandlers> and <httpModules>,arealsorequired for ASP.NET AJAX functionality. The <ht tpHandlers> section defines three things. First, the handler for. asmx Web services is replaced with a new class from the System. web. Extensions namespace. This new class is
capable of handling requests from client-side calls from the AJAX Library, including JSON serialization
and deserialization. Second, a handler is added to enable the use of ASP.NET application services.
The <http:>Modules> section adds a new HTTPmodule that adds additional processing for HTTP requests in the Web application. This enables partial-page postbacks.
The remaining configuration settings are’ configured by the <configSections> settings, which are included as the first child element of <configuration>. This section, which is not listed here, must be included so that you can use the-csys cem. web. extensions> and <system ..webServer> sections.
The <system. web. extensions> section is not included in the default ASP.NET Web Site configuration file; you look at it in the next section.
The next configuration element, <system. webServer>, contains settings that relate to the lIS 7 Web server; this elem~ not required if you are using an earlier version of llS. This configuration section is not listed here.
Finally, there is a <runtime> section as follows:
This section is included to ensure backward compatibility with older versions of ASP.NET AJAX and will have no effect unless you have version 1.0 of ASP.NET AJAX installed. If you do have this version installed, this section enables third-party controls to bind to the latest version of ASP.NET AJAX.
AddItIonal ConfiguratIon OptIons
The <system. web. extensions> section contains settings that provide additional configuration for
ASP.NET AJAX, all of which is optional. This section is not included in the default ASP.NET Web
application template, but you can add it if you need its functionality. Most of the configuration that you
can add with this se~n concerns Web services and is contained in an element called <webServices>,
which in turn is placed in a <scripting> element. First, you can add a section to enable access to the
ASP:NET authentication service t!rr0ugh a Web service (you can choose to enforce SSL here if you wish):
Next, you can enable and configure access to ASP.NET personalization functionality through the profile Web service:
The last Web service-related setting is for enabling and configuring access to ASP.NET role functionality through the role Web service:
Finally, the <system. web. extensions> section can contain an element that enables you to configure compression and caching for asynchronous communications:
AddItIonal ConfiguratIon for the AJAX Control ToolkIt
To use the controls in the AJAX Control Toolkit, you can add the following configuration to Web. config:
This maps the toolkit controls to the ajaxToolkit tag prefix. These controls are contained in the AjaxControl Toolkit assembly, which should be in the Ibin directory for the Web application.
Alternatively, you could register the controls individually on Web page using the <%@ Register %>