Now it is time to use Atlas. Create a new ASP.NET web site using the Atlas template. If you have a look at Solution Explorer, you will see a regular ASP.NET web site. However, there are several different file types in the web site, as shown in Figure 1-9:
A server-side assembly (Microsoft.Web.Atlas.dll) in the Bin directory.
Several client-side JavaScript files. They will also be created by the server-side assembly, but via Start → (All) Programs → Microsoft ASP.NET Atlas → Atlas → Atlas → Atlas Assembly and Script Library, you can have a look at the JavaScript code Atlas will be using.
A Web.config file preconfigured with the settings required for Atlas to work.
Atlas consists of both a server and a client part. It is possible to use only the server components of Atlas, or to use only the client components of Atlas. There is one exception: every Atlas application will need the ScriptManager
server control, which will be covered later in this chapter. Usually, you will want to use both the server and client components of Atlas, of course.
The roles these directories and files play in an Atlas project will become clearer when we take a closer look at how Ajax applications that use XMLHttpRequest
really work.
Figure 1-10 shows the basic structure of Atlas. Whereas standard web pages consist of only two parts—one request and one response—Ajax-enabled web pages can continuously exchange data with the server. Atlas helps on both ends of the wire. Client script libraries in the ScriptLibrary directory facilitate communication between browser and web server and make client coding easier. The server assembly Microsoft.Web.Atlas.dll takes care of accepting and handling XMLHttpRequest
calls and also implements some convenient server web controls that will be covered later in the book. So client and server components can exchange data, with very little work for the programmer.
The Atlas client framework (shown as the bottom layer of the client to the left in Figure 1-10) is sent from the server the first time an Atlas-enabled page is requested (steps 1 and 2 in Figure 1-10). Subsequent requests to the server in an Ajax application are typically made with HTTP requests that return text and XML (steps 3 and 4 in Figure 1-10).
The individual components of Atlas, both on the client and on the server, will be detailed throughout the book. However you should always keep the basic structure in mind, including the data exchange between client and server. The smaller the number of page requests, the better—at least for the purpose of avoiding page refreshes.
Get Programming Atlas now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.