Please read instructions at the end of article on how to run the application after downloading the source.
ASP.NET Atlas is a rich set of client side and server side libraries to develop AJAX-style applications using ASP.NET. This tutorial (and probably more in this series) attempts to provide a general view of the features available in Atlas. Since, Atlas is a very vast library this very first tutorial concentrates on two most important features of Atlas:
- Ability to call server side web services from client side scripts
At the time of writing of this article, December CTP of Atlas can be downloaded by clicking this link. If this link does not work you can always go to the Atlas website to get the correct link. The Atlas library is available as a Visual Studio 2005 template (VSI). The download site has instructions on how to install the template.
Creating an Atlas Project
Once the Atlas template is installed you can create a blank Atlas project by clicking selecting the menu option: File -> New -> Web Site. This brings up the New Web Site dialog box as shown.
Under location you can either select File System or HTTP. Selecting HTTP will allow you to create a web site on an IIS server and selecting File System will allow you to create a web site on your local file system (which you can debug and test using the ASP.NET development web server). You can select either option but I have found the application to work better with Internet Explorer on IIS.
Atlas Blank Project
The newly created Atlas web site has the following directory structure.
This is an empty directory where you can place data files.
This is the directory where dll file for the assembly Microsoft.Web.Atlas is placed. This contains the server portion of the Atlas library.
Atlas client Scripts are placed here in two different subdirectories.
Atlas Client Scripts
The December release of Atlas has the following client scripts.
This is the core Atlas script file consisting of basic utility functions and client side controls and components.
This file contains the Atlas compatibility layer for supporting Mozilla Firefox and Apple-iMac-Safari web browsers. This script ensures that Atlas code is cross browser compatible.
Additional functions to ensure compatibility for the Safari web browser, are included in this file.
This is a scaled down version of the core Atlas script file. This script file does not have the client side components and controls. This script file can be used when the aforementioned components or controls are not being used in a web page.
This file contains utility functions to provide drag drop functionality in a web page.
This file contains utility functions to provide animation and other special effects in a web page.
This is the script file for Atlas mapping framework that uses Virtual Earth.
Atlas adds the following files to the root directory of the web site.
- Default.aspx and Default.aspx.cs
This is a web page containing Atlas Script Manager control that is responsible for rendering script blocks referring to the Atlas client side scripts. An client script of type test/xml-script block is also added to the page. This script block is used to write scripts using declarative XML syntax.
The web.config is essential for running Atlas applications. It contains some configuration settings specific to Atlas and also adds the Atlas HTTP modules and HTTP handlers.
The Scribble Application
The page with the dynamic image and Atlas Script Manager control.
This is an HTTP handler which streams the image object stored in the session variable.
This is the web service to which all the sketching requests are sent. The webservice modifies the image.
Session_Endevents are handled in Global.asax. The
Session_Startcreates the session variable and
Session_Enddisposes the image stored in the session variable.
We begin our coding process from Global.asax.
- In the Website menu click on Add New Item or press Ctrl + Shift + A.
- In the Add New Item dialog box select Global Application Class and click ok. You will see the Global.asax file created.
- We start by importing the
System.Drawingnamespace. Insert the following line of code just after the first line.