A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
This article is based on the prerelease version of ASP. NET "Atlas. All information contained in this document may be changed.
This article introduces the following:
Introduction to ASP. NET "Atlas"
Client and server controls
Atlas and Web Services
This article involves the following technologies:
ASP. NET, Visual Studio 2005, and Internet Explorer
Content on this page
|What is atlas?|
|Client Script core library|
|Client script controls and components|
On April 9, September 2005, the ASP. NET team released the first new feature in ASP. NET, codenamed "Atlas ".CommunityTechnical Preview (CTP ). This feature extension of Microsoft. NET Framework 2.0 allows developers to easily create rich and interactive websites using both browser and server features.
The general problem solved by Ajax lies in the HTTP protocol itself. HTTP is the standard for the browser to communicate with the Web server to retrieve pages and send data back to the server from the browser. The Protocol is stateless, that is,CodeMaintains user input between page refreshes. For a long time, the typical user experience is that the entire page is refreshed to send the status information back to the server. Then, restore the user input on the page in the HTML returned to the browser.
What is atlas?
Figure 1 ASP. NET Atlas Architecture
Figure 2 filter a combo box
Atlas CTP can be downloaded from atlas.asp.net. After installation, it adds the additional C # and Visual Basic. Net website templates to Microsoft Visual Web Developer. When you create a website project in Visual Web Developer (click File> New> website), you will see a dialog box similar to figure 3. The Atlas website includes Microsoft. Web. Atlas. dll and the updated web. config file, which configures Web applications so that they can use the ASP. NET Function Based on Atlas. In the current version, Microsoft. Web. Atlas. dll is placed in the bin directory of the application and can be used as a local assembly throughout the application.
Figure 3 create an Atlas website
Atlas-based applications can be easily deployed by copying files from a development computer to a server with ASP. NET 2.0 installed, eliminating the need to install Atlas separately. Installation is performed at the application level rather than the computer level. These programs can be used on computers that have installed early versions of Atlas after the release of subsequent CTP versions, even if the features have been developed and changed. Compared with system-wide installation, this provides more flexibility for migration to newer versions.Back to Top
Note that the Atlas architecture shown in Figure 1 spans the client and server. Although some additional client functions are added to ASP. NET 2.0, they are not as good as Atlas. On the right side of the Architecture diagram, note that the function of the Atlas server is built on ASP. NET 2.0 and its function is extended. Atlas includes a set of new server controls and new features designed to access server-based data and services from a browser.
Figure 4 shows the typical client-server interaction in a web application. First, request the page through the browser, and then the user interacts with it. When a user needs to retrieve data from the server for some operations, the complete page is refreshed based on the user input. Unfortunately, this behavior does not allow users to continue interacting with the page. The user must pause the web application continuously.
Figure 4 typical client-server interaction
Figure 5 Atlas client-server interaction return directoryBack to Top
Client Script core library
The Atlas client script library is provided to the browser as multiple different fragments. The Script core includes the underlying layer, and the rest of the library is built on the underlying layer. The bottom layer is the browser compatibility layer. A key feature of Atlas is that it runs on popular browsers that support key Ajax elements. In the CTP version, Mozilla Firefox, Apple Safari, and Microsoft Internet Explorer are supported. The browser compatibility layer is an abstraction layer that allows you to write scripts with ease. You do not need to consider the differences between different browser implementations. With it, you can easily extend the Atlas support when the browser develops and releases a new version. The browser that sends the request automatically determines which browser-specific compatibility layer is used. More advanced code has been written into the abstraction layer, so you do not need to write code to handle various changes in the browser implementation.
Client script controls and components
<SCRIPT type = "text/XML-script">
The key to adding a group of additional elements to tags is to use SCRIPT tags. The browser can recognize script elements, but cannot process the text/XML-script type. The Atlas script library can process the elements contained in the script tag itself. The tag is processed by the component layer of the client script library. XML scripts are analyzed on the client to create instances of components and controls. It can contain the property settings of the components and controls it defines, and can declare the binding between them and other HTML elements on the page. The XML script element can also declare web service resources and reference them as data sources in other parts of the tag. The example Page in Figure 8 shows how to use an XML script to declare and determine when the mouse pointer is hovering over the year, the titles associated with the year are displayed as pop-up elements.
By using the server control contained in Atlas CTP, you can easily avoid the pause that occurs during page sending back. When the widget is updated in the background, you can continue to interact with the page. To achieve this goal, the two server controls work collaboratively. You can add it to an existing page to greatly improve the effect. The scriptmanager control modifies the client to be released back, And the updatepanel control manages the page lifecycle on the server to achieve this change.
Setting the enablepartialrendering attribute of the scriptmanager control to true will result in the following new sending behavior from the client:
<Atlas: scriptmanager enablepartialrendering = "true" runat = "server"/>
The updatepanel Control instructs the scriptmanager control on which areas of the page should be updated separately. When operations in the browser cause sending back to the page area, the form data is sent and the lifecycle of the page is executed on the server. Because the script starts sending back asynchronously in the background, the page is still displayed to the user. On the server, the status of the view status data control sent from the client is restored. When the rendering phase occurs, the scriptmanager control isolates the rendering of the updatepanel region because the rendering of this region is being sent back to the browser. The system will also collect view status data of the page and send it together with HTML as part of the response. Then, the scripts in the browser Replace the HTML corresponding to the previous rendering of updatepanel content with the new HTML.
The updatepanel control can contain elements of triggers and contenttemplate:
<Atlas: updatepanel id = "updatepanel1" runat = "server"> <triggers>... </triggers> <contenttemplate>... </contenttemplate> </Atlas: updatepanel>
The regions in contenttemplate are refreshed when the scriptmanager control manages asynchronous sending. The triggers element can contain the controleventtrigger and controlvaluetrigger elements. With the triggers element, page developers can specify specific changes that should lead to region updates. This allows other controls other than the updatepanel control to cause changes without being directly included in the updatepanel control. It also allows you to use simple declarations to control the behavior of pages and updatepanel controls and to indicate when to retrieve new data.
Multiple updatepanel controls can be placed on one page, and different triggers can be used to update them separately. The content of the updatepanel control can be controlled within the minimum range necessary to respond to specific user input. With the updatepanel control, the existing ASP. NET page does not need to be modified in large quantities, so that users can feel more responsive.Back to Top
Web applications are built around the service-oriented architecture. The core of supporting interactive applications is to support accessing services from a browser. Atlas supports two different types of services. The scriptmanager control uses an automatically generated proxy for Web Service reference:
<Atlas: scriptmanager enablepartialrendering = "true" runat = "server"> <services> <Atlas: servicereference generateproxy = "true" Path = "~ /Nominees. aspx "type =" Custom "</services> </Atlas: scriptmanager>
Then, the client component can directly call the Web service from the script. Web services are bound to controls to support richer behavior. For example, you can define autocompletebehavior in an XML script as a possibility to search using web services (see figure 9 ).
SYS. Services. authenticationservice. login (username, password, completionfunction );
The Web service that an application may use is always on the same host server. In fact, they do not even have to be in the same domain. The browser will prevent the use of XMLHttpRequest to call other domains outside the domain where the page is located. There are some clever ways to bypass this restriction, that is, to use a hidden IFRAME object to initiate a request, but it is still troublesome. Atlas provides the Web Service bridging function to support this application scenario. The client can start a web service call, and the target is in another domain. The call is sent to the source Atlas application, which then requests the target server as the proxy user, serializes the result, and returns it to the client. Atlas can also use IFRAME technology to communicate directly with other domains.Back to Top
Now, a new CTP version is released every one month, including repair, change, and new features. Atlas will eventually integrate these into the next version of the. NET Framework (supported during design) in Visual Studio ). Microsoft has recently announced a limited license to allow users to deploy atlas on their actual site and start using Atlas in Web applications. For more information and download the latest Atlas CTP, visit atlas.asp.net.
Matt James is Microsoft's ASP. NET team development manager. Several books on ASP, mobile controls, and ASP. NET. His contact information is firstname.lastname@example.org.
This article is taken from msdn magazine, which was released in July 2006.
2006 Microsoft Corporation is copyrighted. All rights reserved. Usage rules.
Start building with 50+ products and up to 12 months usage for Elastic Compute Service