1.5. Atlas Structure and ArchitectureNow 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: Figure 1-9. The web site project the Atlas template creates
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 partsone request and one responseAjax-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. Figure 1-10. The life cycle of an Atlas web pageThe 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 betterat least for the purpose of avoiding page refreshes. |